Merge pull request #30310 from pass-by-value/empty_bucket_fix

Empty bucket fix
This commit is contained in:
Mike Place 2016-01-13 10:30:45 -07:00
commit edd94aea2c

View File

@ -435,8 +435,17 @@ def _refresh_buckets_cache_file(cache_file):
continue
except KeyError:
# no human readable error message provided
log.warning("'{0}' response for bucket '{1}'".format(meta_response['Code'], bucket_name))
continue
if 'Code' in meta_response:
log.warning(
("'{0}' response for "
"bucket '{1}'").format(meta_response['Code'],
bucket_name))
continue
else:
log.warning(
('S3 Error! Do you have any files '
'in your S3 bucket?'))
return {}
metadata[saltenv] = bucket_files
@ -465,8 +474,17 @@ def _refresh_buckets_cache_file(cache_file):
continue
except KeyError:
# no human readable error message provided
log.warning("'{0}' response for bucket '{1}'".format(meta_response['Code'], bucket_name))
continue
if 'Code' in meta_response:
log.warning(
("'{0}' response for "
"bucket '{1}'").format(meta_response['Code'],
bucket_name))
continue
else:
log.warning(
('S3 Error! Do you have any files '
'in your S3 bucket?'))
return {}
environments = [(os.path.dirname(k['Key']).split('/', 1))[0] for k in files]
environments = set(environments)