コード例 #1
0
def main():
    user = get_user()
    password = get_password()
    database = get_database()

    command = f"mysql -u {user} -p{password} {database}"

    run(['start'], shell=True)
    sleep(0.1)

    typewrite(command)
    press("enter")
コード例 #2
0
def main():
    user = get_user()
    database = get_database()
    password = get_password()

    command = f"psql -U {user} -d {database}"

    run(['start'], shell=True)
    sleep(0.2)

    typewrite(command)
    press("enter")
    sleep(0.5)

    typewrite(password)
    press("enter")
コード例 #3
0
ファイル: cupcake.py プロジェクト: fractos/cupcake
def main():
    logger.info("starting...")

    setup_signal_handling()

    global db
    db = settings.get_database()

    while lifecycle_continues():
        lifecycle()

        if lifecycle_continues():
            logger.info("sleeping for %s seconds..." % settings.SLEEP_SECONDS)
            for _ in range(settings.SLEEP_SECONDS):
                if lifecycle_continues():
                    time.sleep(1)
コード例 #4
0
def main():
    logger.info("starting...")

    setup_signal_handling()

    global db
    db = settings.get_database()

    while lifecycle_continues():
        lifecycle()

        if lifecycle_continues():
            logger.info("sleeping for %s seconds..." % settings.SLEEP_SECONDS)
            for _ in range(settings.SLEEP_SECONDS):
                if lifecycle_continues():
                    time.sleep(1)
コード例 #5
0
def main():
    logger.info("starting...")

    setup_signal_handling()

    global db
    db = settings.get_database()

    # get terraform version from state found with s3 bucket/key
    terraform_version = get_terraform_version(settings.TERRAFORM_S3_BUCKET,
                                              settings.TERRAFORM_S3_KEY)

    # install appropriate terraform version
    terraform_bin = install_terraform(terraform_version)

    # get current head of terraform repository
    # fetch that version as an archive and unzip it
    repo_folder = fetch_current_repo_head()

    # terraform init (with parameters)
    if not terraform_initialise(terraform_bin, repo_folder):
        return

    # terraform plan (with parameters)
    metrics = terraform_plan(terraform_bin, repo_folder)
    if metrics is None:
        return

    # ship metrics
    ship_metrics_to_console(metrics)

    if settings.CLOUDWATCH_NAMESPACE:
        ship_metrics_to_cloudwatch(metrics)

    if settings.SLACK_WEBHOOK_URL and deduplicate_alert(metrics):
        alert_slack(pretty_print_metrics(metrics))
コード例 #6
0
ファイル: manager.py プロジェクト: iamseb/togrog
 def __get__(self, instance, cls):
     self.model = cls
     self.collection = getattr(get_database(), self.model.__name__.lower())
     return self