This is an automated email from the ASF dual-hosted git repository. dimuthuupe pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/airavata-mft.git
commit c7c17da816a1499ea270f6ede9dc80db1cb92282 Author: DImuthuUpe <[email protected]> AuthorDate: Thu Oct 12 01:43:05 2023 -0400 Handling S3 bucket listing errors on cli --- python-cli/mft_cli/airavata_mft_cli/storage/s3.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/python-cli/mft_cli/airavata_mft_cli/storage/s3.py b/python-cli/mft_cli/airavata_mft_cli/storage/s3.py index c6651b8..31a2a97 100644 --- a/python-cli/mft_cli/airavata_mft_cli/storage/s3.py +++ b/python-cli/mft_cli/airavata_mft_cli/storage/s3.py @@ -101,14 +101,16 @@ def handle_add_storage(): direct_req = MFTAgentStubs_pb2.GetResourceMetadataRequest(resourcePath="", secret=secret_wrapper, storage=storage_wrapper) resource_medata_req = MFTTransferApi_pb2.FetchResourceMetadataRequest(directRequest = direct_req) - metadata_resp = client.transfer_api.resourceMetadata(resource_medata_req) - bucket_options = ["Manually Enter"] - bucket_list = metadata_resp.directory.directories - if len(bucket_list) > 0: - for b in bucket_list: - bucket_options.append(b.friendlyName) + try: + metadata_resp = client.transfer_api.resourceMetadata(resource_medata_req) + bucket_list = metadata_resp.directory.directories + if len(bucket_list) > 0: + for b in bucket_list: + bucket_options.append(b.friendlyName) + except: + print("Failed to fetch bucket list. Add the bucket name manually") title = "Select the Bucket: " selected_bucket, index = pick(bucket_options, title, indicator="=>")
