vmware-archive / vcd-cli

Command Line Interface for VMware vCloud Director
https://vmware.github.io/vcd-cli
Other
165 stars 108 forks source link

vcd catalog upload file.iso fails with: Response' object has no attribute 'get #568

Closed nithintitta closed 2 years ago

nithintitta commented 2 years ago

Describe the bug

scripts  /e/iso  vcd catalog upload Beta_builds File.iso Traceback (most recent call last): File "/home/nik/.local/lib/python3.8/site-packages/vcd_cli/catalog.py", line 314, in upload bytes_written = org.upload_media( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/org.py", line 582, in upload_media return self._upload_file( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/org.py", line 761, in _upload_file return self._upload_part_file( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/org.py", line 839, in _upload_part_file response = self.client.upload_fragment( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/client.py", line 1417, in upload_fragment self._response_code_to_exception(sc, None, response) File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/client.py", line 1297, in _response_code_to_exception raise InternalServerException(sc, request_id, objectify_response) pyvcloud.vcd.exceptions.InternalServerException: <exception str() failed>

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/vcd", line 10, in sys.exit(vcd()) File "/usr/lib/python3/dist-packages/click/core.py", line 764, in call return self.main(args, kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke return callback(args, *kwargs) File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), args, **kwargs) File "/home/nik/.local/lib/python3.8/site-packages/vcd_cli/catalog.py", line 319, in upload stderr(e, ctx) File "/home/nik/.local/lib/python3.8/site-packages/vcd_cli/utils.py", line 269, in stderr message = str(exception) File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/exceptions.py", line 44, in str self.vcd_error.get('minorErrorCode'), AttributeError: 'Response' object has no attribute 'get'

scripts  /e/iso  cat vcd_cli_error.log _Traceback (most recent call last): File "/home/nik/.local/lib/python3.8/site-packages/vcd_cli/catalog.py", line 314, in upload bytes_written = org.upload_media( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/org.py", line 582, in upload_media return self._upload_file( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/org.py", line 761, in _upload_file return self._upload_part_file( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/org.py", line 839, in _upload_part_file response = self.client.upload_fragment( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/client.py", line 1417, in upload_fragment self._response_code_to_exception(sc, None, response) File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/client.py", line 1297, in _response_code_to_exception raise InternalServerException(sc, request_id, objectify_response) pyvcloud.vcd.exceptions.InternalServerException:

Traceback (most recent call last): File "/home/nik/.local/lib/python3.8/site-packages/vcd_cli/catalog.py", line 314, in upload bytes_written = org.upload_media( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/org.py", line 582, in upload_media return self._upload_file( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/org.py", line 761, in _upload_file return self._upload_part_file( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/org.py", line 839, in _upload_part_file response = self.client.upload_fragment( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/client.py", line 1417, in upload_fragment self._response_code_to_exception(sc, None, response) File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/client.py", line 1297, in _response_code_to_exception raise InternalServerException(sc, request_id, objectify_response) pyvcloud.vcd.exceptions.InternalServerException:

Traceback (most recent call last): File "/home/nik/.local/lib/python3.8/site-packages/vcd_cli/catalog.py", line 314, in upload bytes_written = org.upload_media( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/org.py", line 582, in upload_media return self._upload_file( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/org.py", line 761, in _upload_file return self._upload_part_file( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/org.py", line 839, in _upload_part_file response = self.client.upload_fragment( File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/client.py", line 1417, in upload_fragment self._response_code_to_exception(sc, None, response) File "/home/nik/.local/lib/python3.8/site-packages/pyvcloud/vcd/client.py", line 1297, in _response_code_to_exception raise InternalServerException(sc, request_id, objectifyresponse) pyvcloud.vcd.exceptions.InternalServerException:

vcd.log: _22-08-22 20:42:50 | client:1314 - _log_request_sent | DEBUG :: Request uri PUT: https://apac-labs-cloud.domain.com/transfer/257b91ff-576c-4625-a2f7-6f5ba5743ebd/file 22-08-22 20:42:50 | client:1317 - _log_request_sent | DEBUG :: Request partial headers: {'Content-Range': 'bytes 0-10485759/8430680064', 'Content-Length': '10485760'} 22-08-22 20:42:50 | client:1333 - _log_request_response | DEBUG :: Request full headers: {'User-Agent': 'python-requests/2.22.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '/', 'Connection': 'keep-alive', 'Authorization': '[REDACTED]', 'Content-Range': 'bytes 0-10485759/8430680064', 'Content-Length': '10485760'} 22-08-22 20:42:50 | client:1335 - _log_request_response | DEBUG :: Response status code: 500 22-08-22 20:42:50 | client:1338 - _log_request_response | DEBUG :: Response headers: {'Content-Length': '0'} 22-08-22 20:42:50 | client:1423 - upload_fragment | DEBUG :: Failure: attempt#1 to upload data in range bytes 0-10485759/8430680064 failed. Retrying. 22-08-22 20:42:50 | client:1314 - _log_request_sent | DEBUG :: Request uri PUT: https://apac-labs-cloud.domain.com/transfer/257b91ff-576c-4625-a2f7-6f5ba5743ebd/file 22-08-22 20:42:50 | client:1317 - _log_request_sent | DEBUG :: Request partial headers: {'Content-Range': 'bytes 0-10485759/8430680064', 'Content-Length': '10485760'} 22-08-22 20:42:50 | client:1333 - _log_request_response | DEBUG :: Request full headers: {'User-Agent': 'python-requests/2.22.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '/', 'Connection': 'keep-alive', 'Authorization': '[REDACTED]', 'Content-Range': 'bytes 0-10485759/8430680064', 'Content-Length': '10485760'} 22-08-22 20:42:50 | client:1335 - _log_request_response | DEBUG :: Response status code: 500 22-08-22 20:42:50 | client:1338 - _log_request_response | DEBUG :: Response headers: {'Content-Length': '0'} 22-08-22 20:42:50 | client:1423 - upload_fragment | DEBUG :: Failure: attempt#2 to upload data in range bytes 0-10485759/8430680064 failed. Retrying. 22-08-22 20:42:50 | client:1314 - _log_request_sent | DEBUG :: Request uri PUT: https://apac-labs-cloud.domain.com/transfer/257b91ff-576c-4625-a2f7-6f5ba5743ebd/file 22-08-22 20:42:50 | client:1317 - _log_request_sent | DEBUG :: Request partial headers: {'Content-Range': 'bytes 0-10485759/8430680064', 'Content-Length': '10485760'} 22-08-22 20:42:51 | client:1333 - _log_request_response | DEBUG :: Request full headers: {'User-Agent': 'python-requests/2.22.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '/', 'Connection': 'keep-alive', 'Authorization': '[REDACTED]', 'Content-Range': 'bytes 0-10485759/8430680064', 'Content-Length': '10485760'} 22-08-22 20:42:51 | client:1335 - _log_request_response | DEBUG :: Response status code: 500 22-08-22 20:42:51 | client:1338 - _log_request_response | DEBUG :: Response headers: {'Content-Length': '0'} 22-08-22 20:42:51 | client:1423 - upload_fragment | DEBUG :: Failure: attempt#3 to upload data in range bytes 0-10485759/8430680064 failed. Retrying. 22-08-22 20:42:51 | client:1314 - _log_request_sent | DEBUG :: Request uri PUT: https://apac-labs-cloud.domain.com/transfer/257b91ff-576c-4625-a2f7-6f5ba5743ebd/file 22-08-22 20:42:51 | client:1317 - _log_request_sent | DEBUG :: Request partial headers: {'Content-Range': 'bytes 0-10485759/8430680064', 'Content-Length': '10485760'} 22-08-22 20:42:51 | client:1333 - _log_request_response | DEBUG :: Request full headers: {'User-Agent': 'python-requests/2.22.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '/', 'Connection': 'keep-alive', 'Authorization': '[REDACTED]', 'Content-Range': 'bytes 0-10485759/8430680064', 'Content-Length': '10485760'} 22-08-22 20:42:51 | client:1335 - _log_request_response | DEBUG :: Response status code: 500 22-08-22 20:42:51 | client:1338 - _log_request_response | DEBUG :: Response headers: {'Content-Length': '0'} 22-08-22 20:42:51 | client:1423 - upload_fragment | DEBUG :: Failure: attempt#4 to upload data in range bytes 0-10485759/8430680064 failed. Retrying. 22-08-22 20:42:51 | client:1314 - _log_request_sent | DEBUG :: Request uri PUT: https://apac-labs-cloud.domain.com/transfer/257b91ff-576c-4625-a2f7-6f5ba5743ebd/file 22-08-22 20:42:51 | client:1317 - _log_request_sent | DEBUG :: Request partial headers: {'Content-Range': 'bytes 0-10485759/8430680064', 'Content-Length': '10485760'} 22-08-22 20:42:51 | client:1333 - _log_request_response | DEBUG :: Request full headers: {'User-Agent': 'python-requests/2.22.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '/', 'Connection': 'keep-alive', 'Authorization': '[REDACTED]', 'Content-Range': 'bytes 0-10485759/8430680064', 'Content-Length': '10485760'} 22-08-22 20:42:51 | client:1335 - _log_request_response | DEBUG :: Response status code: 500 22-08-22 20:42:51 | client:1338 - _log_request_response | DEBUG :: Response headers: {'Content-Length': '0'} 22-08-22 20:42:51 | client:1428 - uploadfragment | ERROR :: Reached max retry limit. Failing upload.

Reproduction steps

1. try to upload a iso to existing catalog using vcd-cli, the fist one takes around a min and fails,  the next tasks fail immediately with similar trace

Expected behavior

i'd expect it to upload iso to the catalog?

Additional context

vcd is behind a nsx-v LB. I have tried by-passing the LB by hardcoding the DNS to one of the VCD node but the issue still persist

nithintitta commented 2 years ago

looks like this errors went away after vcd was upgraded to 10.3.2