def joined(self):
        """Indicate the relation is connected and install required plugins."""
        log("Installing and configuring gearman-plugin for Zuul communication")
        # zuul relation requires we install the required plugins and set the
        # address of the remote zuul/gearman service in the plugin setting.
        plugins = Plugins()
        plugins.install(PLUGINS)
        self.set_state("{relation_name}.connected")

        # Generate plugin config with address of remote unit.
        zuul_host = relation_get("private-address")
        zuul_config = ZUUL_CONFIG.format(zuul_host).encode("utf-8")
        write_file(
            GERMAN_PLUGIN, zuul_config, owner="jenkins", group="nogroup")

        # Restart jenkins so changes will take efect.
        service_restart("jenkins")

        # Trigger the extension hook to update it with zuul relation data, if
        # it's coded to do so.
        hooks = Hooks()
        hooks.execute(["extension-relation-joined"])
    cleanup_ovs_netns,
    stop_neutron_ha_monitor_daemon,
    use_l3ha,
    NEUTRON_COMMON,
    assess_status,
    install_systemd_override,
    configure_apparmor,
    write_vendordata,
    pause_unit_helper,
    resume_unit_helper,
    remove_legacy_nova_metadata,
    disable_nova_metadata,
    remove_old_packages,
)

hooks = Hooks()
CONFIGS = register_configs()


@hooks.hook('install')
@harden()
def install():
    status_set('maintenance', 'Executing pre-install')
    execd_preinstall()
    src = config('openstack-origin')
    if (lsb_release()['DISTRIB_CODENAME'] == 'precise' and
            src == 'distro'):
        src = 'cloud:precise-icehouse'
    configure_installation_source(src)
    status_set('maintenance', 'Installing apt packages')
    apt_update(fatal=True)
Esempio n. 3
0
                        install_chef_cookbooks, \
                        run_recipe #pylint: disable=F0401


KAFKA_CONNECTOR_VERSION = "1.0.0"
ESB_VERSION = "4.9.0"
PING_SOAP_MESSAGE = """<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
   <soapenv:Body>
      <p:echoInt xmlns:p="http://echo.services.core.carbon.wso2.org">
         <in>1</in>
      </p:echoInt>
   </soapenv:Body>
</soapenv:Envelope>"""

HOOKS = Hooks()

@HOOKS.hook('install')
def install():
    # needed because of weird error
    fix_hostname_resolv()
    subprocess.check_call(['sudo', 'apt-get', 'update'])
    install_chef_zero()
    configure_chef_zero()
    # copy cookbooks and upload to server
    install_chef_cookbooks()
    # run wso2 esb cookbook
    run_recipe("wso2::esb")
    # Wait for ESB to start
    counter = 0
    print "Waiting for ESB to come online"
Esempio n. 4
0
    format_ipv6_addr,
    get_relation_ip,
)
from charmhelpers.contrib.storage.linux.ceph import (CephConfContext)
from charmhelpers.contrib.storage.linux.utils import (
    is_device_mounted,
    is_block_device,
)
from charmhelpers.contrib.charmsupport import nrpe
from charmhelpers.contrib.hardening.harden import harden

from charmhelpers.core.unitdata import kv

import charmhelpers.contrib.openstack.vaultlocker as vaultlocker

hooks = Hooks()
STORAGE_MOUNT_PATH = '/var/lib/ceph'


def check_for_upgrade():
    if not os.path.exists(ceph._upgrade_keyring):
        log("Ceph upgrade keyring not detected, skipping upgrade checks.")
        return

    c = hookenv.config()
    old_version = ceph.resolve_ceph_version(c.previous('source') or 'distro')
    log('old_version: {}'.format(old_version))
    new_version = ceph.resolve_ceph_version(
        hookenv.config('source') or 'distro')
    log('new_version: {}'.format(new_version))
Esempio n. 5
0
    get_ipv6_addr,
    is_ipv6,
)

from charmhelpers.contrib.openstack.context import ADDRESS_TYPES

from charmhelpers.contrib.charmsupport import nrpe
from charmhelpers.contrib.hardening.harden import harden

try:
    FileNotFoundError
except NameError:
    # python3 compatibility
    FileNotFoundError = OSError

hooks = Hooks()
CONFIGS = register_configs()
COLO_CONSOLEAUTH = 'inf: res_nova_consoleauth grp_nova_vips'
AGENT_CONSOLEAUTH = 'ocf:openstack:nova-consoleauth'
AGENT_CA_PARAMS = 'op monitor interval="5s"'
NOVA_CONSOLEAUTH_OVERRIDE = '/etc/init/nova-consoleauth.override'


def leader_init_db_if_ready(skip_acl_check=False, skip_cells_restarts=False,
                            db_rid=None, unit=None):
    """Initialise db if leader and db not yet intialised.

    NOTE: must be called from database context.
    """
    if not is_elected_leader(CLUSTER_RES):
        log("Not leader - skipping db init", level=DEBUG)
Esempio n. 6
0
                        configure_chef_zero, \
                        install_chef_cookbooks, \
                        run_recipe #pylint: disable=F0401

KAFKA_CONNECTOR_VERSION = "1.0.0"
ESB_VERSION = "4.9.0"
PING_SOAP_MESSAGE = """<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
   <soapenv:Body>
      <p:echoInt xmlns:p="http://echo.services.core.carbon.wso2.org">
         <in>1</in>
      </p:echoInt>
   </soapenv:Body>
</soapenv:Envelope>"""

HOOKS = Hooks()


@HOOKS.hook('install')
def install():
    # needed because of weird error
    fix_hostname_resolv()
    subprocess.check_call(['sudo', 'apt-get', 'update'])
    install_chef_zero()
    configure_chef_zero()
    # copy cookbooks and upload to server
    install_chef_cookbooks()
    # run wso2 esb cookbook
    run_recipe("wso2::esb")
    # Wait for ESB to start
    counter = 0