vcd-cli
vcd-cli copied to clipboard
Problems with spaces (%2520) in name of catalog or firewall
I found the following problems with spaces in name of catalog or firewall:
This command is OK: vcd gateway services firewall list Transit-VE004 ID name ruleType
131074 firewall internal_high 133123 highAvailability internal_high 131073 default rule for ingress traffic default_policy
This command gives an ERROR:
vcd gateway services firewall list "V Internet Firewall"
Usage: vcd gateway services firewall list [OPTIONS]
Error: 'x-vmware-vcloud-request-id'
The resulting URL according to vcd.log: Request uri (GET): https://some_url/api/query?type=edgeGateway&format=records&page=1&filterEncoded=true&filter=name%3D%3DV%2520Internet%2520Firewall Request headers: {'User-Agent': 'python-requests/2.22.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/*+xml;version=32.0', 'Connection': 'keep-alive', 'x-vcloud-authorization': '[REDACTED]'} Response status code: 500
It seems that the url is encoded twice, giving an erroneous result with spaces becoming %2520.
This problem seems to be equal to https://github.com/vmware/vcd-cli/issues/114, but this ticket gives more info about the problem.
Solution: I have changed the following statement in pyvcloud/vcd/client.py: uri += urllib.parse.quote(qfilter) to uri += qfilter
Now everything works.
Better keep it open, it should be solved in the code,