예제 #1
0
from sh import osf
import paramiko
import datetime
import sys

from echr.utils.logger import getlogger
from echr.utils.cli import TAB
from rich.console import Console
from rich.markdown import Markdown
from rich.progress import (
    Progress,
    BarColumn,
    TimeRemainingColumn,
)

log = getlogger()

MAX_RETRY = 3


def get_client(host, username, password):
    client = paramiko.SSHClient()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    client.connect(host, username=username, password=password)
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    return client


def get_password():
    return os.environ.get('ECHR_PASSWORD')
예제 #2
0
import os
import shutil
from echr.utils.logger import getlogger
from echr.utils.cli import TAB

LOG_FOLDER = './logs'
LOG_PATH = os.path.join(LOG_FOLDER, 'build.log')
log = getlogger(logfile_path=LOG_PATH)


def make_build_folder(console, full_path, force=False, strict=False):
    create_folder = False
    if os.path.isdir(full_path):
        if strict and not force:
            console.print(
                TAB +
                "  ⮡ [bold red]:double_exclamation_mark: Step folder exists.")
            console.print(
                TAB +
                "    [bold red] > Select another folder or delete the previous build"
            )
            exit(1)
        elif not force:
            console.print(
                TAB +
                '  ⮡ [bold blue]! Step folder exists. The build will be UPDATED.'
            )
            console.print(
                TAB +
                "    [bold yellow]:warning: If you don't want to update the build, use --force flag"
            )