|
|
@ -221,10 +221,6 @@ def load_config(path: str) -> any: |
|
|
|
with open(path, 'r') as config_file: |
|
|
|
config = json.load(config_file) |
|
|
|
|
|
|
|
# Setup S3 Settings |
|
|
|
config['s3']['access'] = os.getenv('ACM_S3_ACCESS') |
|
|
|
config['s3']['secret'] = os.getenv('ACM_S3_SECRET') |
|
|
|
|
|
|
|
# Setup concurrency |
|
|
|
if 'concurrency' in config: |
|
|
|
config['concurrency'] = abs(int(config['concurrency'])) |
|
|
@ -281,8 +277,9 @@ def print_config(ctx): |
|
|
|
@click.option('--sha256sum/--no-sha256sum', default=False) |
|
|
|
@click.option('--suffix', default=None) |
|
|
|
@click.option('-x', '--context', required=True) |
|
|
|
@click.option('--print-identity/--no-print-identity', default=False) |
|
|
|
@click.pass_context |
|
|
|
def list_files(ctx, context, sha256sum, suffix): |
|
|
|
def list_files(ctx, context, sha256sum, suffix, print_identity): |
|
|
|
ctx.obj['CONTEXT'] = context |
|
|
|
s3_config = ctx.obj['CONFIG']['s3'] |
|
|
|
s3_bucket = ctx.obj['CONTEXT'] |
|
|
@ -312,11 +309,16 @@ def list_files(ctx, context, sha256sum, suffix): |
|
|
|
file = file.strip() |
|
|
|
|
|
|
|
if sha256sum: |
|
|
|
stat = s3.stat_object(s3_bucket, obj) |
|
|
|
sha256sum_value = stat.metadata[get_metadata_name("SHA256SUM")] |
|
|
|
file_object = s3.get_object(s3_bucket, obj) |
|
|
|
stored_data = json.load(file_object) |
|
|
|
sha256sum_value = stored_data['sha256sum'] |
|
|
|
file = f'{sha256sum_value} {file}' |
|
|
|
|
|
|
|
found_files.append(file) |
|
|
|
elif print_identity: |
|
|
|
file_object = s3.get_object(s3_bucket, obj) |
|
|
|
stored_data = json.load(file_object) |
|
|
|
found_files.append(stored_data['storedAssetIdentity']) |
|
|
|
else: |
|
|
|
found_files.append(file) |
|
|
|
|
|
|
|
print(os.linesep.join(found_files)) |
|
|
|
|
|
|
|