Browse Source

Added print identity to list

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

11
acm.py

@ -277,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']
@ -311,8 +312,12 @@ def list_files(ctx, context, sha256sum, suffix):
stat = s3.stat_object(s3_bucket, obj)
sha256sum_value = stat.metadata[get_metadata_name("SHA256SUM")]
file = f'{sha256sum_value} {file}'
found_files.append(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)
print(os.linesep.join(found_files))

Loading…
Cancel
Save