6657: copy_pipeline_template method also updated to check git existence.
[arvados.git] / sdk / python / arvados / commands / arv_copy.py
index 1d10b042729f1712a896a4d1d17c1a01d1cef29c..62bf047a8d750e1135e1061702d79d3b0ec31b53 100755 (executable)
@@ -212,6 +212,12 @@ def copy_pipeline_instance(pi_uuid, src, dst, args):
     pi = src.pipeline_instances().get(uuid=pi_uuid).execute(num_retries=args.retries)
 
     if args.recursive:
+        # Check if git is available
+        try:
+            arvados.util.run_command(['git', '--help'])
+        except:
+            abort('git command is not available. Please ensure git is installed.')
+
         if not args.dst_git_repo:
             abort('--dst-git-repo is required when copying a pipeline recursively.')
         # Copy the pipeline template and save the copied template.
@@ -265,6 +271,12 @@ def copy_pipeline_template(pt_uuid, src, dst, args):
     pt = src.pipeline_templates().get(uuid=pt_uuid).execute(num_retries=args.retries)
 
     if args.recursive:
+        # Check if git is available
+        try:
+            arvados.util.run_command(['git', '--help'])
+        except:
+            abort('git command is not available. Please ensure git is installed.')
+
         if not args.dst_git_repo:
             abort('--dst-git-repo is required when copying a pipeline recursively.')
         # Copy input collections, docker images and git repos.