X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2b7d9f3f2e687d524ccc1d88e470e721f63f9e51..3be96c96a4ff1c519e03e6dc2036e0b93e41ee8c:/sdk/python/arvados/commands/arv_copy.py diff --git a/sdk/python/arvados/commands/arv_copy.py b/sdk/python/arvados/commands/arv_copy.py index 62bf047a8d..09cd9d42e3 100755 --- a/sdk/python/arvados/commands/arv_copy.py +++ b/sdk/python/arvados/commands/arv_copy.py @@ -188,6 +188,13 @@ def api_for_instance(instance_name): abort('need ARVADOS_API_HOST and ARVADOS_API_TOKEN for {}'.format(instance_name)) return client +# Check if git is available +def check_git_availability(): + try: + arvados.util.run_command(['git', '--help']) + except: + abort('git command is not available. Please ensure git is installed.') + # copy_pipeline_instance(pi_uuid, src, dst, args) # # Copies a pipeline instance identified by pi_uuid from src to dst. @@ -212,11 +219,7 @@ 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.') + check_git_availability() if not args.dst_git_repo: abort('--dst-git-repo is required when copying a pipeline recursively.') @@ -271,11 +274,7 @@ 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.') + check_git_availability() if not args.dst_git_repo: abort('--dst-git-repo is required when copying a pipeline recursively.')