Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

VCD, pyvcloud, vcd-cli error: Error: local variable 'links' referenced before assignment #569

Open
anlong05 opened this issue Sep 8, 2022 · 0 comments
Labels

Comments

@anlong05
Copy link

anlong05 commented Sep 8, 2022

Describe the bug

Customer is trying to create a vApp using vcd-cli and receiving an error

Client Environment - MacOS 12.5
vcd-cli, VMware vCloud Director Command Line Interface, 24.1.0
Python 3.10.6 Pip 22.2.2,
vCD 10.2.2.1

The following command fails:

  • vcd login
    tecsadmin logged in, org: 'system', vdc: ''

  • vcd org use ICTN4200
    InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised.
    now using org: 'ICTN4200', vdc: 'ICTN4200-OVDC', vApp: ''

  • vcd vapp create 4201-Fall2022-grayj17 -c ICTN4200-catalog -t 4201-Base-2022
    InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised.
    Usage: vcd vapp create [OPTIONS]
    Try 'vcd vapp create -h' for help.

Error: local variable 'links' referenced before assignment

##################

Unable to find reference to 'links' other than what's listed below:

./2022_08_15.request.log.191206443
150.216.57.23 - - [15/Aug/2022:10:47:37 -0400] "GET https://cloud.cet.ecu.edu/api/query?type=catalog&format=records&type=catalog&page=1&pageSize=5&filterEncoded=true&filter=(publishSubscriptionType!=SUBSCRIBED;name!=ICTN4200-catalog)&sortAsc=name&links=true HTTP/1.1" 200 1363 "https://cloud.cet.ecu.edu/tenant/ictn4200/libraries/vapp-templates" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0" 26
150.216.57.23 - - [15/Aug/2022:10:47:49 -0400] "GET https://cloud.cet.ecu.edu/api/query?type=catalog&format=records&type=catalog&page=1&pageSize=5&filterEncoded=true&filter=(publishSubscriptionType!=SUBSCRIBED;name!=ICTN4200-catalog)&sortDesc=name&links=true HTTP/1.1" 200 1365 "https://cloud.cet.ecu.edu/tenant/ictn4200/libraries/vapp-templates" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0" 23
150.216.57.23 - - [15/Aug/2022:10:47:50 -0400] "GET https://cloud.cet.ecu.edu/api/query?type=catalog&format=records&type=catalog&page=1&pageSize=5&filterEncoded=true&filter=(publishSubscriptionType!=SUBSCRIBED;name!=ICTN4200-catalog)&sortAsc=name&links=true HTTP/1.1" 200 1363 "https://cloud.cet.ecu.edu/tenant/ictn4200/libraries/vapp-templates" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0" 31
150.216.57.23 - - [15/Aug/2022:10:47:52 -0400] "GET https://cloud.cet.ecu.edu/api/query?type=catalog&format=records&type=catalog&page=1&pageSize=5&filterEncoded=true&filter=(publishSubscriptionType!=SUBSCRIBED;name!=ICTN4200-catalog)&sortDesc=name&links=true HTTP/1.1" 200 1365 "https://cloud.cet.ecu.edu/tenant/ictn4200/libraries/vapp-templates" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0" 29
150.216.57.23 - - [15/Aug/2022:11:47:22 -0400] "GET https://cloud.cet.ecu.edu/api/query?type=vAppTemplate&page=1&pageSize=10&filterEncoded=true&filter=catalogName==ICTN4200-catalog&links=true HTTP/1.1" 200 3287 "https://cloud.cet.ecu.edu/tenant/ictn4200/libraries/vapp-templates" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Geck

Reproduction steps

1. Login to a vCloud Director primary cell 
2. run the 'vcd vapp create' command with an attached catalog
3. links error appears

Expected behavior

Customer has other OrgVDCs he can build vApps on, this is the only one that throws the 'links' error.

Additional context

vcd.log

    <ResourceEntity href="https://cloud.cet.ecu.edu/api/vApp/vapp-4db8c086-6342-45d0-8331-1276b9d0b13c" id="urn:vcloud:vapp:4db8c086-6342-45d0-8331-1276b9d0b13c" type="application/vnd.vmware.vcloud.vApp+xml" name="4201-Fall2022-grayj17"/>

<AdminVAppRecord name="4201-Fall2022-grayj17" org="https://cloud.cet.ecu.edu/api/org/538f0086-b544-4698-8cd8-4bfa173c985a" vdc="https://cloud.cet.ecu.edu/api/vdc/20ea1203-3070-4417-b124-d5f093c72f5b" vdcName="ICTN4200-OVDC" isVdcEnabled="true" description=" " isEnabled="true" isBusy="false" creationDate="2022-08-19T09:53:21.336-04:00" status="POWERED_OFF" ownerName="system" storageKB="67108864" numberOfVMs="1" memoryAllocationMB="6144" isDeployed="false" isInMaintenanceMode="false" isAutoNature="false" isExpired="false" numberOfCpus="2" totalStorageAllocatedMb="137216" href="https://cloud.cet.ecu.edu/api/vApp/vapp-4db8c086-6342-45d0-8331-1276b9d0b13c" taskStatusName="vappCreateSnapshot" lowestHardwareVersionInVApp="14" autoDeleteDate="2022-12-07T08:55:59.217-05:00" task="https://cloud.cet.ecu.edu/api/task/40dbef59-be67-4648-8f96-5d971b5f4d0c" honorBootOrder="false" pvdcHighestSupportedHardwareVersion="14" taskStatus="success" cpuAllocationInMhz="2000"/>

vcd_cli_error.log

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/vcd_cli/vapp.py", line 1250, in add
vapp = VApp(client, resource=vdc.get_vapp(vapp_name))
File "/Users/jgray/Library/Python/3.8/lib/python/site-packages/pyvcloud/vcd/vdc.py", line 203, in get_vapp
return self.client.get_resource(self.get_vapp_href(name))
File "/Users/jgray/Library/Python/3.8/lib/python/site-packages/pyvcloud/vcd/vdc.py", line 182, in get_vapp_href
raise EntityNotFoundException(
pyvcloud.vcd.exceptions.EntityNotFoundException: Vapp with name '4201-Fall2022-grayj17' not found.

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/vcd_cli/vapp.py", line 803, in stop_vapp
vapp = get_vapp(ctx, vapp_name)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/vcd_cli/vapp.py", line 1882, in get_vapp
return VApp(client, resource=vdc.get_vapp(vapp_name))
File "/Users/jgray/Library/Python/3.8/lib/python/site-packages/pyvcloud/vcd/vdc.py", line 203, in get_vapp
return self.client.get_resource(self.get_vapp_href(name))
File "/Users/jgray/Library/Python/3.8/lib/python/site-packages/pyvcloud/vcd/vdc.py", line 182, in get_vapp_href
raise EntityNotFoundException(
pyvcloud.vcd.exceptions.EntityNotFoundException: Vapp with name '4201-Fall2022-grayj17' not found.

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/vcd_cli/vapp.py", line 528, in create
vapp_resource = vdc.instantiate_vapp(
File "/Users/jgray/Library/Python/3.8/lib/python/site-packages/pyvcloud/vcd/vdc.py", line 300, in instantiate_vapp
catalog_item = org.get_catalog_item(catalog, template)
File "/Users/jgray/Library/Python/3.8/lib/python/site-packages/pyvcloud/vcd/org.py", line 330, in get_catalog_item
catalog_resource = self.get_catalog(name)
File "/Users/jgray/Library/Python/3.8/lib/python/site-packages/pyvcloud/vcd/org.py", line 202, in get_catalog
if links:
UnboundLocalError: local variable 'links' referenced before assignment

The vapp didn't create yet, so when it requested the vapp_name, it wasn't found.
Confirmed the Tenant had access to the ICTN4200-catalog from UI.

vcd-cli-running-shell-error

screenshot_build-vapps-4200_sh

@anlong05 anlong05 added the bug label Sep 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant