ucloud-setup/app/helper.py

36 lines
793 B
Python
Raw Normal View History

2019-08-27 08:31:22 +00:00
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