Skip to content Skip to sidebar Skip to footer

Google Cloud Storage Bucket.get_blob To Verified File Path Returns None

I am able to verify the existence of finished_json_path in the bucket_name, but I get finished_json_blob value of None, when running this code... Any insights really appreciated!

Solution 1:

On the error can se that the full path you are calling is: origin-ci-test/origin-ci-test/pr-logs/pull/openshift_release/12691/rehearse-12691-pull-ci-operator-framework-operator-marketplace-release-4.6-okd-images/1326467646144647168/finished.json which seems to be that the bucket is passed twice.

The issue is that when calling get_blob you are already on the bucket but you are passing it again as part of finished_json_path

Here I am attaching he code removing the additional part of the path.

bucket_name = mdata_list[0]
org_repo = mdata_list[3]
pull_number = mdata_list[4]
job_name = mdata_list[5]
build_number = mdata_list[6]

prlogs_pull_dir = "/pr-logs/pull"prlogs_directory_dir = bucket_name + "/pr_logs/directory"finished_json_path = prlogs_pull_dir + "/" + org_repo + "/" + pull_number + "/" + job_name + "/" + build_number + "/" + "finished.json"events_json_url = prlogs_pull_dir + "/" + org_repo + "/" + pull_number + "/" + job_name + "/" + build_number + "artifacts/build-resources/events.json"storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
finished_json_blob = bucket.get_blob(finished_json_path)
finished_json = finished_json_blob.download_as_string()

Post a Comment for "Google Cloud Storage Bucket.get_blob To Verified File Path Returns None"