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")
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")
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)
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))
def __get__(self, instance, cls): self.model = cls self.collection = getattr(get_database(), self.model.__name__.lower()) return self