6657: check git is installed in arv-copy
[arvados.git] / sdk / python / arvados / commands / arv_copy.py
index c64b645a381cd3c8f5e47a175bee6b1a7f0b0024..5e48bc4831e577560f1ea41b300cce7f5d19a3f5 100755 (executable)
@@ -32,6 +32,8 @@ import arvados.util
 import arvados.commands._util as arv_cmd
 import arvados.commands.keepdocker
 
+from arvados.api import OrderedJsonModel
+
 logger = logging.getLogger('arvados.arv-copy')
 
 # local_repo_dir records which git repositories from the Arvados source
@@ -180,7 +182,8 @@ def api_for_instance(instance_name):
         client = arvados.api('v1',
                              host=cfg['ARVADOS_API_HOST'],
                              token=cfg['ARVADOS_API_TOKEN'],
-                             insecure=api_is_insecure)
+                             insecure=api_is_insecure,
+                             model=OrderedJsonModel())
     else:
         abort('need ARVADOS_API_HOST and ARVADOS_API_TOKEN for {}'.format(instance_name))
     return client
@@ -586,6 +589,12 @@ def copy_collection(obj_uuid, src, dst, args):
 #    to both repositories.
 #
 def copy_git_repo(src_git_repo, src, dst, dst_git_repo, script_version, args):
+    # Check if git is available
+    try:
+        arvados.util.run_command(['git', '--help'])
+    except:
+        raise Exception('git command is not available. Please ensure git is installed.')
+
     # Identify the fetch and push URLs for the git repositories.
     r = src.repositories().list(
         filters=[['name', '=', src_git_repo]]).execute(num_retries=args.retries)