Example #1
0
def rename_instance(current_instance, new_instance):
    """ Rename a given instance with new name
        to keep databases item authorization"""
    execute(tyr.stop_tyr_worker)
    execute(tyr.rename_tyr_instance, current_instance, new_instance)
    execute(jormungandr.remove_jormungandr_instance, current_instance)
    execute(tyr.remove_tyr_instance, current_instance)

    execute(db.rename_postgresql_database,
            db.instance2postgresql_name(current_instance),
            db.instance2postgresql_name(new_instance))
    execute(db.rename_tyr_jormungandr_database, current_instance, new_instance)
Example #2
0
def rename_instance(current_instance, new_instance):
    """ Rename a given instance with new name
        to keep databases item authorization"""
    execute(tyr.stop_tyr_worker)
    execute(tyr.rename_tyr_instance, current_instance, new_instance)
    execute(jormungandr.remove_jormungandr_instance, current_instance)
    execute(tyr.remove_tyr_instance, current_instance)

    execute(db.rename_postgresql_database,
            db.instance2postgresql_name(current_instance),
            db.instance2postgresql_name(new_instance))
    execute(db.rename_tyr_jormungandr_database, current_instance, new_instance)
Example #3
0
def remove_tyr_instance(instance, purge_logs=False):
    """Remove a tyr instance entirely
        * Remove ini file
        * Restart tyr worker
        * Remove tyr log
    """
    # ex.: /etc/tyr.d/fr-bou.ini
    run("rm --force %s/%s.ini" % (env.tyr_base_instances_dir, instance))
    execute(restart_tyr_worker)
    restart_tyr_beat()
    if purge_logs:
        # ex.: /var/log/tyr/northwest.log
        run("rm --force %s/%s.log" % (env.tyr_base_logdir, instance))

    # purge instance in jormungandr database
    execute(db.remove_instance_from_jormun_database, instance)

    # purge the instance database and user
    with warn_only():
        execute(db.remove_postgresql_database, db.instance2postgresql_name(instance))
        execute(db.remove_postgresql_user, db.instance2postgresql_name(instance))
Example #4
0
def remove_tyr_instance(instance, purge_logs=False):
    """Remove a tyr instance entirely
        * Remove ini file
        * Restart tyr worker
        * Remove tyr log
    """
    # ex.: /etc/tyr.d/fr-bou.ini
    run("rm --force %s/%s.ini" % (env.tyr_base_instances_dir, instance))
    execute(restart_tyr_worker)
    restart_tyr_beat()
    if purge_logs:
        # ex.: /var/log/tyr/northwest.log
        run("rm --force %s/%s.log" % (env.tyr_base_logdir, instance))

    # purge instance in jormungandr database
    execute(db.remove_instance_from_jormun_database, instance)

    # purge the instance database and user
    with warn_only():
        execute(db.remove_postgresql_database,
                db.instance2postgresql_name(instance))
        execute(db.remove_postgresql_user,
                db.instance2postgresql_name(instance))