Exemplo n.º 1
0
def config_changed():
    if config('prefer-ipv6'):
        status_set('maintenance', 'configuring ipv6')
        setup_ipv6()
        sync_db_with_multi_ipv6_addresses(config('database'),
                                          config('database-user'))

    unison.ensure_user(user=SSH_USER, group='juju_keystone')
    unison.ensure_user(user=SSH_USER, group='keystone')
    homedir = unison.get_homedir(SSH_USER)
    if not os.path.isdir(homedir):
        mkdir(homedir, SSH_USER, 'juju_keystone', 0o775)

    if git_install_requested():
        if config_value_changed('openstack-origin-git'):
            status_set('maintenance', 'Running Git install')
            git_install(config('openstack-origin-git'))
    elif not config('action-managed-upgrade'):
        if openstack_upgrade_available('keystone'):
            status_set('maintenance', 'Running openstack upgrade')
            do_openstack_upgrade_reexec(configs=CONFIGS)

    for r_id in relation_ids('cluster'):
        cluster_joined(rid=r_id, ssl_sync_request=False)

    config_changed_postupgrade()
Exemplo n.º 2
0
def config_changed():
    if config('prefer-ipv6'):
        status_set('maintenance', 'configuring ipv6')
        setup_ipv6()
        sync_db_with_multi_ipv6_addresses(config('database'),
                                          config('database-user'))

    unison.ensure_user(user=SSH_USER, group='juju_keystone')
    # NOTE(coreycb): can just use group='keystone' once snap has drop privs support
    if snap_install_requested():
        unison.ensure_user(user=SSH_USER, group='root')
    else:
        unison.ensure_user(user=SSH_USER, group='keystone')
    homedir = unison.get_homedir(SSH_USER)
    if not os.path.isdir(homedir):
        mkdir(homedir, SSH_USER, 'juju_keystone', 0o775)

    if git_install_requested():
        if config_value_changed('openstack-origin-git'):
            status_set('maintenance', 'Running Git install')
            git_install(config('openstack-origin-git'))
    elif not config('action-managed-upgrade'):
        if openstack_upgrade_available('keystone'):
            status_set('maintenance', 'Running openstack upgrade')
            do_openstack_upgrade_reexec(configs=CONFIGS)

    config_changed_postupgrade()
Exemplo n.º 3
0
def install():
    status_set('maintenance', 'Executing pre-install')
    execd_preinstall()
    configure_installation_source(config('openstack-origin'))
    status_set('maintenance', 'Installing apt packages')
    apt_update()
    apt_install(determine_packages(), fatal=True)

    if snap_install_requested():
        status_set('maintenance', 'Installing keystone snap')
        snap_install('keystone', '--edge', '--classic')
        service_pause('snap.keystone.uwsgi')
        service_pause('snap.keystone.nginx')
    else:
        if run_in_apache():
            disable_unused_apache_sites()
            if not git_install_requested():
                service_pause('keystone')

    status_set('maintenance', 'Git install')
    git_install(config('openstack-origin-git'))

    unison.ensure_user(user=SSH_USER, group='juju_keystone')
    # NOTE(coreycb): can just use group='keystone' once snap has drop privs support
    if snap_install_requested():
        unison.ensure_user(user=SSH_USER, group='root')
    else:
        unison.ensure_user(user=SSH_USER, group='keystone')
Exemplo n.º 4
0
 def test_git_install(self, git_pre, git_post, git_clone_and_install,
                      git_requested):
     projects_yaml = openstack_origin_git
     git_requested.return_value = True
     utils.git_install(projects_yaml)
     self.assertTrue(git_pre.called)
     git_clone_and_install.assert_called_with(openstack_origin_git,
                                              core_project='keystone')
     self.assertTrue(git_post.called)
Exemplo n.º 5
0
 def test_git_install(self, git_pre, git_post, git_clone_and_install,
                      git_requested):
     projects_yaml = openstack_origin_git
     git_requested.return_value = True
     utils.git_install(projects_yaml)
     self.assertTrue(git_pre.called)
     git_clone_and_install.assert_called_with(openstack_origin_git,
                                              core_project='keystone')
     self.assertTrue(git_post.called)
Exemplo n.º 6
0
def install():
    status_set('maintenance', 'Executing pre-install')
    execd_preinstall()
    configure_installation_source(config('openstack-origin'))
    status_set('maintenance', 'Installing apt packages')
    apt_update()
    apt_install(determine_packages(), fatal=True)

    status_set('maintenance', 'Git install')
    git_install(config('openstack-origin-git'))
Exemplo n.º 7
0
def install():
    status_set('maintenance', 'Executing pre-install')
    execd_preinstall()
    configure_installation_source(config('openstack-origin'))
    status_set('maintenance', 'Installing apt packages')
    apt_update()
    apt_install(determine_packages(), fatal=True)

    status_set('maintenance', 'Git install')
    git_install(config('openstack-origin-git'))

    unison.ensure_user(user=SSH_USER, group='juju_keystone')
    unison.ensure_user(user=SSH_USER, group='keystone')
Exemplo n.º 8
0
def config_changed():
    if config('prefer-ipv6'):
        status_set('maintenance', 'configuring ipv6')
        setup_ipv6()
        sync_db_with_multi_ipv6_addresses(config('database'),
                                          config('database-user'))

    unison.ensure_user(user=SSH_USER, group='juju_keystone')
    unison.ensure_user(user=SSH_USER, group='keystone')
    homedir = unison.get_homedir(SSH_USER)
    if not os.path.isdir(homedir):
        mkdir(homedir, SSH_USER, 'juju_keystone', 0o775)

    if git_install_requested():
        if config_value_changed('openstack-origin-git'):
            status_set('maintenance', 'Running Git install')
            git_install(config('openstack-origin-git'))
    elif not config('action-managed-upgrade'):
        if openstack_upgrade_available('keystone'):
            status_set('maintenance', 'Running openstack upgrade')
            do_openstack_upgrade(configs=CONFIGS)

    # Ensure ssl dir exists and is unison-accessible
    ensure_ssl_dir()

    check_call(['chmod', '-R', 'g+wrx', '/var/lib/keystone/'])

    ensure_ssl_dirs()

    save_script_rc()
    configure_https()

    update_nrpe_config()
    CONFIGS.write_all()

    if is_pki_enabled():
        initialise_pki()

    update_all_identity_relation_units()

    for rid in relation_ids('identity-admin'):
        admin_relation_changed(rid)

    # Ensure sync request is sent out (needed for any/all ssl change)
    send_ssl_sync_request()

    for r_id in relation_ids('ha'):
        ha_joined(relation_id=r_id)
Exemplo n.º 9
0
def install():
    status_set('maintenance', 'Executing pre-install')
    execd_preinstall()
    configure_installation_source(config('openstack-origin'))
    status_set('maintenance', 'Installing apt packages')
    apt_update()
    apt_install(determine_packages(), fatal=True)
    if run_in_apache():
        disable_unused_apache_sites()
        if not git_install_requested():
            service_pause('keystone')

    status_set('maintenance', 'Git install')
    git_install(config('openstack-origin-git'))

    unison.ensure_user(user=SSH_USER, group='juju_keystone')
    unison.ensure_user(user=SSH_USER, group='keystone')
Exemplo n.º 10
0
def config_changed():
    if config("prefer-ipv6"):
        status_set("maintenance", "configuring ipv6")
        setup_ipv6()
        sync_db_with_multi_ipv6_addresses(config("database"), config("database-user"))

    unison.ensure_user(user=SSH_USER, group="juju_keystone")
    unison.ensure_user(user=SSH_USER, group="keystone")
    homedir = unison.get_homedir(SSH_USER)
    if not os.path.isdir(homedir):
        mkdir(homedir, SSH_USER, "juju_keystone", 0o775)

    if git_install_requested():
        if config_value_changed("openstack-origin-git"):
            status_set("maintenance", "Running Git install")
            git_install(config("openstack-origin-git"))
    elif not config("action-managed-upgrade"):
        if openstack_upgrade_available("keystone"):
            status_set("maintenance", "Running openstack upgrade")
            do_openstack_upgrade_reexec(configs=CONFIGS)

    config_changed_postupgrade()
Exemplo n.º 11
0
def install():
    status_set('maintenance', 'Executing pre-install')
    execd_preinstall()
    configure_installation_source(config('openstack-origin'))
    status_set('maintenance', 'Installing apt packages')
    apt_update()
    apt_install(determine_packages(), fatal=True)
    if run_in_apache():
        # NOTE: ensure that packaging provided
        #       apache configuration is disabled
        #       as it will conflict with the charm
        #       provided version. when deployed from
        #       source, init scripts aren't installed.
        if os.path.exists(PACKAGE_KEYSTONE_CONF):
            check_call(['a2dissite', 'keystone'])
        if not git_install_requested():
            service_pause('keystone')

    status_set('maintenance', 'Git install')
    git_install(config('openstack-origin-git'))

    unison.ensure_user(user=SSH_USER, group='juju_keystone')
    unison.ensure_user(user=SSH_USER, group='keystone')
Exemplo n.º 12
0
def install():
    status_set("maintenance", "Executing pre-install")
    execd_preinstall()
    configure_installation_source(config("openstack-origin"))
    status_set("maintenance", "Installing apt packages")
    apt_update()
    apt_install(determine_packages(), fatal=True)
    if run_in_apache():
        # NOTE: ensure that packaging provided
        #       apache configuration is disabled
        #       as it will conflict with the charm
        #       provided version. when deployed from
        #       source, init scripts aren't installed.
        if os.path.exists(PACKAGE_KEYSTONE_CONF):
            check_call(["a2dissite", "keystone"])
        if not git_install_requested():
            service_pause("keystone")

    status_set("maintenance", "Git install")
    git_install(config("openstack-origin-git"))

    unison.ensure_user(user=SSH_USER, group="juju_keystone")
    unison.ensure_user(user=SSH_USER, group="keystone")