Beispiel #1
0
def install_apt_packages():
    """
    Install both core and extra apt packages
    """

    install(config('core_packages').split())
    install(config('extra_packages').split())
Beispiel #2
0
def set_current(app_path):
    """
    Set an app directory to the currently live app
    by creating a symlink as specified in config
    """

    current_link_path = os.path.join(
        config('install_path'),
        config('live_symlink_name')
    )

    sh.rm(current_link_path, force=True)
    sh.ln(app_path, current_link_path, symbolic=True)
Beispiel #3
0
def get_app_tgz():
    """
    Get the app tar.gz file from the config (if specified)
    and save it in the cache directory
    for later extraction
    """

    app_tgz_path = os.path.join(cache_dir(), 'project.tgz')
    b64_tgz = config('app_package')

    if b64_tgz:
        tgz_contents = b64decode()

        with open(app_tgz_path, 'w') as tgz_file:
            tgz_file.write(tgz_contents)

    return app_tgz_path
Beispiel #4
0
def extract_app_files():
    """
    Extract the app zip file
    into an install directory (specified in config)
    """

    app_tgz_path = get_app_tgz()

    install_dir = datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
    install_path = os.path.join(config('install_path'), install_dir)

    # Extract files into install dir
    sh.tar(
        file=app_tgz_path,
        directory=install_path,
        strip=1, z=True, x=True
    )

    return install_path
Beispiel #5
0
    host
)

from lib.charmhelpers.fetch import (
    apt_update,
    apt_upgrade,
    apt_install
)

from lib.charmhelpers.contrib.openstack.utils import (
    configure_installation_source
)

hooks = hookenv.Hooks()
log = hookenv.log
config = hookenv.config()

SERVICES = ['trove-api', 'trove-taskmanager', 'trove-conductor']


@hooks.hook('install')
def install():
    log('Updating apt source')
    apt_update()

    log('Upgrading packages')
    apt_upgrade()

    log('Installing openstack-trove')
    apt_install('python-trove',
                'python-troveclient',