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

Error: 'set' object is not subscriptable #519

Open
SA0TAY opened this issue Mar 27, 2020 · 1 comment
Open

Error: 'set' object is not subscriptable #519

SA0TAY opened this issue Mar 27, 2020 · 1 comment

Comments

@SA0TAY
Copy link

SA0TAY commented Mar 27, 2020

Due to similar issues as in #511, I'm using vcd-cli==22.0.0 and pyvcloud==21.0.0, but I'm experiencing the same problem installing the latest from git with pip3 install git+git://github.com/vmware/vcd-cli.git.

Commands such as vcd cse template list work just fine. When I try to make a new cluster, however, this is what happens:

(cse) ubuntu@staging-vps:~$ vcd cse cluster create TEST
Usage: vcd cse cluster create [OPTIONS] NAME
Try 'vcd cse cluster create -h' for help.

Error: 'set' object is not subscriptable

I am on Python 3.7.5 in a virtualenv, and the installed packages are as follows:

(cse) ubuntu@staging-vps:~$ pip list
Package                     Version    
--------------------------- -----------
cachetools                  4.0.0      
certifi                     2019.11.28 
cffi                        1.14.0     
chardet                     3.0.4      
click                       7.1.1      
colorama                    0.4.3      
container-service-extension 2.5.1      
cryptography                2.8        
entrypoints                 0.3        
humanfriendly               8.1        
idna                        2.9        
jeepney                     0.4.3      
keyring                     12.0.0     
lxml                        4.5.0      
pika                        0.13.1     
pip                         20.0.2     
pkg-resources               0.0.0      
pycparser                   2.20       
pycryptodome                3.4.11     
Pygments                    2.6.1      
python-dateutil             2.8.1      
pyvcloud                    21.0.0     
pyvmomi                     6.7.3      
PyYAML                      5.3.1      
requests                    2.23.0     
SecretStorage               3.1.2      
setuptools                  46.1.3     
six                         1.14.0     
tabulate                    0.8.7      
unittest-xml-reporting      3.0.2      
urllib3                     1.25.8     
vcd-api-schemas-type        9.1.2.dev10
vcd-cli                     22.0.0     
vsphere-guest-run           0.0.7      
wheel                       0.34.2     
(cse) ubuntu@staging-vps:~$

This is what appears in the logs, minus identifying bits:

==> vcd.log <==
Request uri (POST): https://[EXPUNGED]/api/cse/clusters
Request headers: {'User-Agent': 'python-requests/2.23.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json;version=33.0', 'Connection': 'keep-alive', 'x-vcloud-authorization': '[REDACTED]', 'Content-Type': 'application/json', 'Content-Length': '281'}
Request body: {"cluster_name": "TEST", "num_workers": null, "ovdc_name": "[EXPUNGED]", "num_cpu": null, "mb_memory": null, "network_name": null, "storage_profile_name": null, "ssh_key": null, "template_name": null, "template_revision": null, "enable_nfs": false, "rollback": true, "org_name": "[EXPUNGED]"}
Response status code: 500
Response headers: {'Date': 'Fri, 27 Mar 2020 12:01:30 GMT', 'X-VMWARE-VCLOUD-REQUEST-ID': '[EXPUNGED]', 'X-VMWARE-VCLOUD-CEIP-ID': '[EXPUNGED]', 'Content-Type': 'application/json', 'Content-Length': '95'}
Response body: {"message": {"minor error code": -1, "error description": "'set' object is not subscriptable"}}

==> vcd_cli_error.log <==
Traceback (most recent call last):
  File "/home/ubuntu/cse/lib/python3.7/site-packages/container_service_extension/client/cse.py", line 372, in cluster_create
    org=org_name)
  File "/home/ubuntu/cse/lib/python3.7/site-packages/container_service_extension/client/cluster.py", line 118, in create_cluster
    return process_response(response)
  File "/home/ubuntu/cse/lib/python3.7/site-packages/container_service_extension/client/response_processor.py", line 41, in process_response
    raise response_to_exception(response)
  File "/home/ubuntu/cse/lib/python3.7/site-packages/container_service_extension/client/response_processor.py", line 99, in response_to_exception
    response.status_code, error_message, minor_error_code)
container_service_extension.exceptions.CseResponseError: 'set' object is not subscriptable

Searching the tracker from the container-service-extension repo gave me vmware/container-service-extension#544, but I'm not sure how it relates.

@rocknes
Copy link
Collaborator

rocknes commented Mar 27, 2020

I think this error is a bug in CSE which we found after releasing 2.5.1. If you send wrong payload to CSE, the payload verifier tries to create a set of missing/invalid keys. The bug being we use [] operator on the set, which is not supported.

I am sure that this bug is related to malformed payload. Can you not send null in the payload. Just drop the key. num_workers can be set to 1.

Regards
Aritra Sen

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants