ucloud-setup/app/helper.py
2019-08-27 13:31:22 +05:00

36 lines
No EOL
793 B
Python

import subprocess
def clone(repo):
command = f"git clone {repo}"
try:
subprocess.check_output(command.split())
except subprocess.CalledProcessError as e:
return False
else:
return True
def clone_common():
return clone("https://code.ungleich.ch/ungleich-public/ucloud_common")
def clone_etcd_wrapper():
return clone("https://code.ungleich.ch/ahmedbilal/etcd3_wrapper")
class Operation(object):
def __init__(self):
self.result = []
def execute(self, rc):
self.result.append(rc)
def pipenv_install(_dir):
command = f"pipenv install"
try:
subprocess.check_output(command.split(), cwd=_dir)
except subprocess.CalledProcessError as e:
return False
else:
return True