Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fail early for too-long resource names
The resource name length in IBM Cloud needs to be <= 63 characters. If we attempt to allocate a set of resources (machine, volumes, IP, ...) and one of the names for those resources is too long, the library fails with pretty cryptic traceback: Traceback (most recent call last): File "/usr/bin/resalloc-ibm-cloud-vm", line 8, in <module> sys.exit(main()) ^^^^^^ File "/usr/lib/python3.11/site-packages/resalloc_ibm_cloud/ibm_cloud_vm.py", line 348, in main create_instance(service, name, opts) File "/usr/lib/python3.11/site-packages/resalloc_ibm_cloud/ibm_cloud_vm.py", line 182, in create_instance response = service.create_instance(instance_prototype_model) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/ibm_vpc/vpc_v1.py", line 4583, in create_instance response = self.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/ibm_cloud_sdk_core/base_service.py", line 341, in send raise ApiException(response.status_code, http_response=response) ibm_cloud_sdk_core.api_exception.ApiException: Error: Expected only one oneOf fields to be set: got 0, Code: 400 With this fix, we'll get the failure much faster: ERROR: Field boot_volume_attachment.volume.name is longer than 63 characters: copr-ibm-cloud-s390x-washington-prod-13290257-20231024-201117-root
- Loading branch information