This commit is contained in:
ahmadbilalkhalid 2019-08-30 06:23:45 +05:00
commit a9f8d245b9
10 changed files with 127 additions and 83 deletions

View file

@ -11,6 +11,7 @@ from app.helper import (
PipenvOperation,
FileOperation,
PackageManagementOperation,
VirtualenvOperation
)
@ -32,15 +33,24 @@ def api():
default="https://otp.ungleich.ch/ungleichotp/",
help="URL of ungleich OTP server",
)
def setup(path, auth_name, auth_seed, auth_realm,
realm_allowed, otp_server, etcd_url,
etcd_password):
def setup(
path,
auth_name,
auth_seed,
auth_realm,
realm_allowed,
otp_server,
etcd_url,
etcd_password,
):
os.chdir(path)
repo_name = "ucloud-api"
# Git Operation Depends on success of previous operation i.e PackageManagementOperation
op = GitOperation.clone(url=f"https://code.ungleich.ch/ungleich-public/{repo_name}.git")
op = GitOperation.clone(
url=f"https://code.ungleich.ch/ungleich-public/{repo_name}.git"
)
content = (
f"AUTH_NAME={auth_name}\n"
@ -53,9 +63,7 @@ def setup(path, auth_name, auth_seed, auth_realm,
)
# FileOperation depends on success of previos operation i.e GitOperation.clone
op.add(
FileOperation.write, path=os.path.join(repo_name, ".env"), content=content
)
op.add(FileOperation.write, path=os.path.join(repo_name, ".env"), content=content)
op.add(
GitOperation.clone,
@ -66,8 +74,10 @@ def setup(path, auth_name, auth_seed, auth_realm,
op.add(
GitOperation.clone,
path=repo_name,
url="https://code.ungleich.ch/ahmedbilal/etcd3_wrapper"
url="https://code.ungleich.ch/ahmedbilal/etcd3_wrapper",
)
shutil.copytree(src=os.path.join(repo_name, "etcd3_wrapper"),
dst=os.path.join(repo_name, "ucloud_common", "etcd3_wrapper"))
op.add(PipenvOperation.install, path=repo_name)
shutil.copytree(
src=os.path.join(repo_name, "etcd3_wrapper"),
dst=os.path.join(repo_name, "ucloud_common", "etcd3_wrapper"),
)
op.add(VirtualenvOperation.install, path=repo_name)