This commit is contained in:
ahmadbilalkhalid 2019-09-17 17:43:30 +05:00
parent 041af6c34d
commit abbf68d5f1
6 changed files with 23 additions and 76 deletions

View file

@ -1,10 +1,8 @@
import click
import subprocess as sp
import os
import shutil
from app.helper import install_available
from decouple import config
@click.group()
def api():
@ -20,15 +18,16 @@ def api():
@click.option("--etcd_url", required=True)
@click.option("--otp_server", default="https://otp.ungleich.ch/ungleichotp/",
help="URL of ungleich OTP server")
@click.option("--branch", default="master")
def setup(path, auth_name, auth_seed, auth_realm,
realm_allowed, otp_server, etcd_url):
realm_allowed, otp_server, etcd_url, branch):
os.chdir(path)
repo_name = "ucloud-api"
# Clone main repo
sp.check_output(['git', 'clone', '--single-branch', '--branch', 'wip',
sp.check_output(['git', 'clone', '--single-branch', '--branch', branch,
f'https://code.ungleich.ch/ungleich-public/{repo_name}.git'])
# Create .env file
@ -49,21 +48,9 @@ def setup(path, auth_name, auth_seed, auth_realm,
)
f.writelines(content)
# Clone Common and Etcd Wrapper
# clone_common(path=repo_name)
# clone_etcd_wrapper(path=repo_name)
# Copy Etcd Wrapper inside ucloud_common as ucloud_common
# also needs etcd wrapper
# shutil.copytree(
# src=os.path.join(repo_name, "etcd3_wrapper"),
# dst=os.path.join(repo_name, "ucloud_common", "etcd3_wrapper"),
# )
install_available(repo_name)
# Create virtualenv with site-packages enabled and install all dependencies
# sp.check_output(['pipenv','--site-packages', '--three'], cwd=repo_name)
sp.check_output(['pipenv', 'install'], cwd=repo_name)
sp.check_output(['pipenv', 'run', 'python', 'create_image_store.py'], cwd=repo_name)

View file

@ -16,13 +16,14 @@ def cli():
@click.option("--name", required=True)
@click.option("--realm", required=True)
@click.option("--seed", required=True)
def setup(path, api_server, name, realm, seed):
@click.option("--branch", default="master")
def setup(path, api_server, name, realm, seed, branch):
os.chdir(path)
repo_name = "ucloud-cli"
# Clone main repo
sp.check_output(['git', 'clone', '--single-branch', '--branch', 'wip',
sp.check_output(['git', 'clone', '--single-branch', '--branch', branch,
f'https://code.ungleich.ch/ucloud/{repo_name}.git'])
# Create .env file
@ -35,19 +36,7 @@ def setup(path, api_server, name, realm, seed):
)
f.writelines(content)
# Clone Common and Etcd Wrapper
# clone_common(path=repo_name)
# clone_etcd_wrapper(path=repo_name)
# Copy Etcd Wrapper inside ucloud_common as ucloud_common
# also needs etcd wrapper
# shutil.copytree(
# src=os.path.join(repo_name, "etcd3_wrapper"),
# dst=os.path.join(repo_name, "ucloud_common", "etcd3_wrapper"),
# )
install_available(repo_name)
# Create virtualenv with site-packages enabled and install all dependencies
# sp.check_output(['pipenv','--site-packages', '--three'], cwd=repo_name)
sp.check_output(['pipenv', 'install'], cwd=repo_name)

View file

@ -2,7 +2,7 @@ import click
import subprocess as sp
import os
from app.helper import clone_etcd_wrapper, install_available
from app.helper import install_available
@click.group()
def file_scan():
@ -14,13 +14,14 @@ def file_scan():
@click.option("--base_dir", required=True)
@click.option("--file_prefix", required=True)
@click.option("--etcd_url", required=True)
def setup(path, base_dir, file_prefix, etcd_url):
@click.option("--branch", default="master")
def setup(path, base_dir, file_prefix, etcd_url, branch):
os.chdir(path)
repo_name = "ucloud-file-scan"
# Clone main repository
sp.check_output(['git', 'clone', '--single-branch', '--branch', 'wip',
sp.check_output(['git', 'clone', '--single-branch', '--branch', branch,
f'https://code.ungleich.ch/ungleich-public/{repo_name}.git'])
# Create .env file
@ -37,14 +38,10 @@ def setup(path, base_dir, file_prefix, etcd_url):
f"FILE_PREFIX=/v1/file/\n"
)
f.writelines(content)
# Clone etcd wrapper
# clone_etcd_wrapper(path=repo_name)
install_available(repo_name)
# Create virtualenv with site-packages enabled and install all dependencies
# sp.check_output(['pipenv','--site-packages', '--three'], cwd=repo_name)
sp.check_output(['pipenv', 'install'], cwd=repo_name)
# TODO: Devuan/Debian have crontab under /etc/crontab

View file

@ -1,9 +1,8 @@
import click
import subprocess as sp
import os
import shutil
from app.helper import clone_common, clone_etcd_wrapper, install_available
from app.helper import install_available
@click.group()
@ -18,13 +17,14 @@ def host():
@click.option("--ssh_key_pass", required=True)
@click.option("--etcd_url", required=True)
@click.option("--without_ceph", default=False, type=bool)
def setup(path, ssh_username, ssh_key_path, ssh_key_pass, etcd_url, without_ceph):
@click.option("--branch", default="master")
def setup(path, ssh_username, ssh_key_path, ssh_key_pass, etcd_url, without_ceph, branch):
os.chdir(path)
repo_name = "ucloud-vm"
# Clone main repo
sp.check_output(['git', 'clone', '--single-branch', '--branch', 'wip',
sp.check_output(['git', 'clone', '--single-branch', '--branch', branch,
f'https://code.ungleich.ch/ungleich-public/{repo_name}.git'])
# Create .env file
@ -44,19 +44,7 @@ def setup(path, ssh_username, ssh_key_path, ssh_key_pass, etcd_url, without_ceph
)
f.writelines(content)
# Clone Common and Etcd Wrapper
# clone_common(path=repo_name)
# clone_etcd_wrapper(path=repo_name)
# Copy Etcd Wrapper inside ucloud_common as ucloud_common
# also needs etcd wrapper
# shutil.copytree(
# src=os.path.join(repo_name, "etcd3_wrapper"),
# dst=os.path.join(repo_name, "ucloud_common", "etcd3_wrapper"),
# )
install_available(repo_name)
# Create virtualenv with site-packages enabled and install all dependencies
# sp.check_output(['pipenv','--site-packages', '--three'], cwd=repo_name)
sp.check_output(['pipenv', 'install'], cwd=repo_name)

View file

@ -2,7 +2,7 @@ import click
import subprocess as sp
import os
from app.helper import clone_etcd_wrapper, install_available
from app.helper import install_available
@click.group()
def image():
@ -14,13 +14,14 @@ def image():
@click.option("--base_dir", required=True)
@click.option("--etcd_url", required=True)
@click.option("--without_ceph", default=False, type=bool)
def setup(path, base_dir, etcd_url, without_ceph):
@click.option("--branch", default="master")
def setup(path, base_dir, etcd_url, without_ceph, branch):
os.chdir(path)
repo_name = "ucloud-image-scanner"
# Clone main repo
sp.check_output(['git', 'clone', '--single-branch', '--branch', 'wip',
sp.check_output(['git', 'clone', '--single-branch', '--branch', branch,
f'https://code.ungleich.ch/ungleich-public/{repo_name}.git'])
# Create .env file
@ -37,14 +38,9 @@ def setup(path, base_dir, etcd_url, without_ceph):
f"FILE_PREFIX=/v1/file/\n"
)
f.writelines(content)
# clone_etcd_wrapper(path=repo_name)
install_available(repo_name)
# Create virtualenv with site-packages enabled and install all dependencies
# sp.check_output(['pipenv','--site-packages', '--three'], cwd=repo_name)
sp.check_output(['pipenv', 'install'], cwd=repo_name)
# TODO: Devuan/Debian have crontab under /etc/crontab

View file

@ -17,13 +17,14 @@ def scheduler():
@click.option("--host_prefix", required=True)
@click.option("--request_prefix", required=True)
@click.option("--etcd_url", required=True)
def setup(path, vm_prefix, host_prefix, request_prefix, etcd_url):
@click.option("--branch", default="master")
def setup(path, vm_prefix, host_prefix, request_prefix, etcd_url, branch):
os.chdir(path)
repo_name = "ucloud-scheduler"
# Clone main repo
sp.check_output(['git', 'clone', '--single-branch', '--branch', 'wip',
sp.check_output(['git', 'clone', '--single-branch', '--branch', branch,
f'https://code.ungleich.ch/ungleich-public/{repo_name}.git'])
# Create .env file
@ -42,19 +43,8 @@ def setup(path, vm_prefix, host_prefix, request_prefix, etcd_url):
)
f.writelines(content)
# Clone Common and Etcd Wrapper
# clone_common(path=repo_name)
# clone_etcd_wrapper(path=repo_name)
# Copy Etcd Wrapper inside ucloud_common as ucloud_common
# also needs etcd wrapper
# shutil.copytree(
# src=os.path.join(repo_name, "etcd3_wrapper"),
# dst=os.path.join(repo_name, "ucloud_common", "etcd3_wrapper"),
# )
install_available(repo_name)
# Create virtualenv with site-packages enabled and install all dependencies
# sp.check_output(['pipenv','--site-packages', '--three'], cwd=repo_name)
sp.check_output(['pipenv', 'install'], cwd=repo_name)