Browse Source

Added print identity to list

add-file-preservation 1.1.3
Drew Short 5 years ago
parent
commit
89c536d1bf
  1. 9
      acm.py

9
acm.py

@ -277,8 +277,9 @@ def print_config(ctx):
@click.option('--sha256sum/--no-sha256sum', default=False) @click.option('--sha256sum/--no-sha256sum', default=False)
@click.option('--suffix', default=None) @click.option('--suffix', default=None)
@click.option('-x', '--context', required=True) @click.option('-x', '--context', required=True)
@click.option('--print-identity/--no-print-identity', default=False)
@click.pass_context @click.pass_context
def list_files(ctx, context, sha256sum, suffix):
def list_files(ctx, context, sha256sum, suffix, print_identity):
ctx.obj['CONTEXT'] = context ctx.obj['CONTEXT'] = context
s3_config = ctx.obj['CONFIG']['s3'] s3_config = ctx.obj['CONFIG']['s3']
s3_bucket = ctx.obj['CONTEXT'] s3_bucket = ctx.obj['CONTEXT']
@ -311,7 +312,11 @@ def list_files(ctx, context, sha256sum, suffix):
stat = s3.stat_object(s3_bucket, obj) stat = s3.stat_object(s3_bucket, obj)
sha256sum_value = stat.metadata[get_metadata_name("SHA256SUM")] sha256sum_value = stat.metadata[get_metadata_name("SHA256SUM")]
file = f'{sha256sum_value} {file}' file = f'{sha256sum_value} {file}'
else if 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) found_files.append(file)
print(os.linesep.join(found_files)) print(os.linesep.join(found_files))

Loading…
Cancel
Save