Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def mock_verbosity(verbosity):
old_verbosity = get_verbosity()
set_verbosity(verbosity)
yield
set_verbosity(old_verbosity)
def unset(env_vars, staging, production, verbose):
"""Unset environment variables - each of {ENV_VARS} must be of the form 'KEY'"""
set_verbosity(verbose)
context = select_context(staging, production)
hokusai.unset_env(context, env_vars)
def run(command, tty, tag, env, constraint, verbose):
"""Launch a new container and run a command"""
set_verbosity(verbose)
hokusai.run(KUBE_CONTEXT, command, tty, tag, env, constraint)
def copy(app_name, verbose):
"""Copies the app's environment config map to the namespace {APP_NAME}"""
set_verbosity(verbose)
hokusai.k8s_copy_config(KUBE_CONTEXT, clean_string(app_name))
def unset(env_vars, verbose):
"""Unset environment variables - each of {ENV_VARS} must be of the form 'KEY'"""
set_verbosity(verbose)
hokusai.unset_env(KUBE_CONTEXT, env_vars)
def deploy(tag, migration, constraint, git_remote, timeout, update_config, filename, verbose):
"""Update the project's deployment(s) to reference
the given image tag and update the tag production
to reference the same image"""
set_verbosity(verbose)
hokusai.update(KUBE_CONTEXT, tag, migration, constraint, git_remote, timeout, update_config=update_config, filename=filename)
def status(app_name, resources, pods, describe, top, verbose):
"""Print the Kubernetes resources status defined in the staging context / {APP_NAME} namespace"""
set_verbosity(verbose)
hokusai.k8s_status(KUBE_CONTEXT, resources, pods, describe, top, namespace=clean_string(app_name), filename=os.path.join(CWD, HOKUSAI_CONFIG_DIR, "%s.yml" % app_name))
def restart(deployment, verbose):
"""Alias for 'refresh'"""
set_verbosity(verbose)
hokusai.refresh(KUBE_CONTEXT, deployment)
def set(app_name, env_vars, verbose):
"""Set environment variables - each of {ENV_VARS} must be in of form 'KEY=VALUE'"""
set_verbosity(verbose)
hokusai.set_env(KUBE_CONTEXT, env_vars, namespace=clean_string(app_name))
def setup(project_name, template_remote, template_dir, var, allow_missing_vars, verbose):
"""Set up Hokusai for the current project"""
set_verbosity(verbose)
hokusai.setup(project_name, template_remote, template_dir, var, allow_missing_vars)