Ejemplo n.º 1
0
 def test_register_configs_pre_install(self, _isdir):
     _isdir.return_value = False
     self.os_release.return_value = 'havana'
     configs = horizon_utils.register_configs()
     confs = [
         horizon_utils.LOCAL_SETTINGS, horizon_utils.HAPROXY_CONF,
         horizon_utils.PORTS_CONF, horizon_utils.APACHE_DEFAULT,
         horizon_utils.APACHE_CONF, horizon_utils.APACHE_SSL
     ]
     calls = []
     for conf in confs:
         calls.append(
             call(conf, horizon_utils.CONFIG_FILES[conf]['hook_contexts']))
     configs.register.assert_has_calls(calls)
 def test_register_configs_pre_install(self, _isdir):
     _isdir.return_value = False
     self.os_release.return_value = 'havana'
     configs = horizon_utils.register_configs()
     confs = [horizon_utils.LOCAL_SETTINGS,
              horizon_utils.HAPROXY_CONF,
              horizon_utils.PORTS_CONF,
              horizon_utils.APACHE_DEFAULT,
              horizon_utils.APACHE_CONF,
              horizon_utils.APACHE_SSL]
     calls = []
     for conf in confs:
         calls.append(
             call(conf, horizon_utils.CONFIG_FILES[conf]['hook_contexts']))
     configs.register.assert_has_calls(calls)
 def test_register_configs_pre_install(self, _exists):
     _exists.return_value = False
     self.get_os_codename_package.return_value = None
     configs = horizon_utils.register_configs()
     confs = [horizon_utils.LOCAL_SETTINGS,
              horizon_utils.HAPROXY_CONF,
              horizon_utils.APACHE_CONF,
              horizon_utils.APACHE_SSL,
              horizon_utils.APACHE_DEFAULT,
              horizon_utils.PORTS_CONF]
     for conf in confs:
         configs.register.assert_any_call(
             conf,
             horizon_utils.CONFIG_FILES[conf]['hook_contexts']
         )
Ejemplo n.º 4
0
 def test_register_configs_apache24(self, _isdir, _isfile, _remove):
     _isdir.return_value = True
     _isfile.return_value = True
     self.os_release.return_value = 'havana'
     self.cmp_pkgrevno.return_value = 1
     configs = horizon_utils.register_configs()
     confs = [horizon_utils.LOCAL_SETTINGS,
              horizon_utils.HAPROXY_CONF,
              horizon_utils.PORTS_CONF,
              horizon_utils.APACHE_24_DEFAULT,
              horizon_utils.APACHE_24_CONF,
              horizon_utils.APACHE_24_SSL]
     calls = []
     for conf in confs:
         calls.append(
             call(conf, horizon_utils.CONFIG_FILES[conf]['hook_contexts']))
     configs.register.assert_has_calls(calls)
     oldconfs = [horizon_utils.APACHE_CONF,
                 horizon_utils.APACHE_SSL,
                 horizon_utils.APACHE_DEFAULT]
     rmcalls = []
     for conf in oldconfs:
         rmcalls.append(call(conf))
     _remove.assert_has_calls(rmcalls)
    openstack_upgrade_available,
    save_script_rc
)
from horizon_utils import (
    PACKAGES, register_configs,
    restart_map,
    LOCAL_SETTINGS, HAPROXY_CONF,
    enable_ssl,
    do_openstack_upgrade
)
from charmhelpers.contrib.hahelpers.apache import install_ca_cert
from charmhelpers.contrib.hahelpers.cluster import get_hacluster_config
from charmhelpers.payload.execd import execd_preinstall

hooks = Hooks()
CONFIGS = register_configs()


@hooks.hook('install')
def install():
    configure_installation_source(config('openstack-origin'))
    apt_update(fatal=True)
    apt_install(filter_installed_packages(PACKAGES), fatal=True)


@hooks.hook('upgrade-charm')
@restart_on_change(restart_map())
def upgrade_charm():
    execd_preinstall()
    apt_install(filter_installed_packages(PACKAGES), fatal=True)
    CONFIGS.write_all()
Ejemplo n.º 6
0
def resume(args):
    """Resume the Ceilometer services.
    @raises Exception should the service fail to start."""
    resume_unit_helper(register_configs())
Ejemplo n.º 7
0
def pause(args):
    """Pause the Ceilometer services.
    @raises Exception should the service fail to stop.
    """
    pause_unit_helper(register_configs())
from charmhelpers.contrib.network.ip import (
    get_iface_for_address,
    get_netmask_for_address,
    get_ipv6_addr,
    is_ipv6,
    get_relation_ip,
)
from charmhelpers.contrib.hahelpers.apache import install_ca_cert
from charmhelpers.contrib.hahelpers.cluster import get_hacluster_config
from charmhelpers.payload.execd import execd_preinstall
from charmhelpers.contrib.charmsupport import nrpe
from charmhelpers.contrib.hardening.harden import harden
from base64 import b64decode

hooks = Hooks()
CONFIGS = register_configs()


@hooks.hook('install.real')
@harden()
def install():
    execd_preinstall()
    configure_installation_source(config('openstack-origin'))

    apt_update(fatal=True)
    packages = determine_packages()
    _os_release = os_release('openstack-dashboard')
    if CompareOpenStackReleases(_os_release) < 'icehouse':
        packages += ['nodejs', 'node-less']
    if lsb_release()['DISTRIB_CODENAME'] == 'precise':
        # Explicitly upgrade python-six Bug#1420708