Ejemplo n.º 1
0
def get_and_bootstrap_kolla(env, force=False):
    """This gets kolla in the current directory.

    force iff a potential previous installation must be overwritten.
    """

    kolla_path = os.path.join(env['resultdir'], 'kolla')

    if force and os.path.isdir(kolla_path):
        logging.info("Remove previous Kolla installation")
        check_call("rm -rf %s" % kolla_path, shell=True)
    if not os.path.isdir(kolla_path):
        logging.info("Cloning Kolla repository...")
        check_call("git clone %s --branch %s --single-branch --quiet %s" %
                   (env['config']['kolla_repo'], env['config']['kolla_ref'],
                    kolla_path),
                   shell=True)
        # Bootstrap kolla running by patching kolla sources (if any) and
        # generating admin-openrc, globals.yml, passwords.yml
        bootstrap_kolla(env)

    return kolla_path
Ejemplo n.º 2
0
def install_os(env=None, **kwargs):
    logging.debug('phase[os]: args=%s' % kwargs)

    # Clone or pull Kolla
    kolla_path = os.path.join(env['resultdir'], 'kolla')
    if os.path.isdir(kolla_path):
        logging.info("Remove previous Kolla installation")
        call("rm -rf %s" % kolla_path, shell=True)

    logging.info("Cloning Kolla repository...")
    call("git clone %s --branch %s --single-branch --quiet %s" %
         (env['config']['kolla_repo'], env['config']['kolla_ref'], kolla_path),
         shell=True)

    # Bootstrap kolla running by patching kolla sources (if any) and
    # generating admin-openrc, globals.yml, passwords.yml
    bootstrap_kolla(env)

    # Construct kolla-ansible command...
    kolla_cmd = [os.path.join(kolla_path, "tools", "kolla-ansible")]

    if kwargs['--reconfigure']:
        kolla_cmd.append('reconfigure')
    else:
        kolla_cmd.append('deploy')

    kolla_cmd.extend([
        "-i",
        "%s/multinode" % env['resultdir'], "--passwords",
        "%s/passwords.yml" % env['resultdir'], "--configdir",
        "%s" % env['resultdir']
    ])

    if kwargs['--tags']:
        kolla_cmd.extend(['--tags', kwargs['--tags']])

    logging.info("Calling Kolla...")
    call(kolla_cmd)