Merge branch 'master' into 3036-collection-uuids
[arvados.git] / sdk / python / arvados / commands / put.py
index da26a3ce01aa26df2be68b42cf1d51602ed9b9ab..7b6b048b1d035adc7b3b3399fd77a2c81e3bed3b 100644 (file)
@@ -457,14 +457,17 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr):
                 },
             ).execute()
 
-        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:
                 if 'name' in collection:
-                    arvados.api().collections().update(uuid=output,
-                                                       body={"owner_uuid": project_link["tail_uuid"],
-                                                             "name": project_link["name"]}).execute()
+                    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: