X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/327e1768a130476a411baf4cd4fb602f7a73c5ed..d7e750680bbf5e655d7c986ce0cff550c8022ca4:/sdk/python/arvados/commands/put.py diff --git a/sdk/python/arvados/commands/put.py b/sdk/python/arvados/commands/put.py index e4b763ad08..7b6b048b1d 100644 --- a/sdk/python/arvados/commands/put.py +++ b/sdk/python/arvados/commands/put.py @@ -453,20 +453,30 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr): collection = api_client.collections().create( body={ 'manifest_text': writer.manifest_text(), + 'owner_uuid': project_link['tail_uuid'] }, ).execute() - # Print the locator (uuid) of the new collection. - output = collection['uuid'] + if 'portable_data_hash' in collection and collection['portable_data_hash']: + output = collection['portable_data_hash'] + else: + output = collection['uuid'] + if project_link is not None: + # Update collection name try: - create_project_link(output, project_link) + if 'name' in collection: + arvados.api().collections().update(uuid=collection['uuid'], + body={"name": project_link["name"]}).execute() + else: + create_project_link(output, project_link) except apiclient.errors.Error as error: print >>stderr, ( "arv-put: Error adding Collection to project: {}.".format( error)) status = 1 + # Print the locator (uuid) of the new collection. stdout.write(output) if not output.endswith('\n'): stdout.write('\n')