projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
6657: refactor git check and reuse.
[arvados.git]
/
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 62bf047a8d750e1135e1061702d79d3b0ec31b53..09cd9d42e3bb8b6969501f01c3800b2ddca68d74 100755
(executable)
--- 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
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.
# 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:
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.')
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:
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.')
if not args.dst_git_repo:
abort('--dst-git-repo is required when copying a pipeline recursively.')