def openstack_upgrade(): """Upgrade packages to config-set Openstack version. If the charm was installed from source we cannot upgrade it. For backwards compatibility a config flag must be set for this code to run, otherwise a full service level upgrade will fire on config-changed.""" if (do_action_openstack_upgrade('glance-common', do_openstack_upgrade, register_configs())): config_changed()
def test_register_configs_apache24(self, exists): exists.return_value = True self.os_release.return_value = 'grizzly' self.relation_ids.return_value = False configs = utils.register_configs() calls = [] for conf in [ utils.GLANCE_REGISTRY_CONF, utils.GLANCE_API_CONF, utils.HAPROXY_CONF, utils.HTTPS_APACHE_24_CONF ]: calls.append(call(conf, utils.CONFIG_FILES[conf]['hook_contexts'])) configs.register.assert_has_calls(calls, any_order=True)
def test_register_configs_apache24(self, exists): exists.return_value = True self.os_release.return_value = 'grizzly' self.relation_ids.return_value = False configs = utils.register_configs() calls = [] for conf in [utils.GLANCE_REGISTRY_CONF, utils.GLANCE_API_CONF, utils.HAPROXY_CONF, utils.HTTPS_APACHE_24_CONF]: calls.append( call(conf, utils.CONFIG_FILES[conf]['hook_contexts']) ) configs.register.assert_has_calls(calls, any_order=True)
def test_register_configs_ceph(self, exists): exists.return_value = True self.os_release.return_value = 'grizzly' self.relation_ids.return_value = ['ceph:0'] self.service_name.return_value = 'glance' configs = utils.register_configs() calls = [] for conf in [ utils.GLANCE_REGISTRY_CONF, utils.GLANCE_API_CONF, utils.HAPROXY_CONF, utils.ceph_config_file() ]: calls.append(call(conf, utils.CONFIG_FILES[conf]['hook_contexts'])) configs.register.assert_has_calls(calls, any_order=True) self.mkdir.assert_called_with('/etc/ceph')
def test_register_configs_ceph(self, exists): exists.return_value = True self.os_release.return_value = 'grizzly' self.relation_ids.return_value = ['ceph:0'] self.service_name.return_value = 'glance' configs = utils.register_configs() calls = [] for conf in [utils.GLANCE_REGISTRY_CONF, utils.GLANCE_API_CONF, utils.HAPROXY_CONF, utils.ceph_config_file()]: calls.append( call(conf, utils.CONFIG_FILES[conf]['hook_contexts']) ) configs.register.assert_has_calls(calls, any_order=True) self.mkdir.assert_called_with('/etc/ceph')
def test_register_configs_ceph(self, exists): exists.return_value = False self.get_os_codename_package.return_value = 'grizzly' self.relation_ids.return_value = ['ceph:0'] configs = utils.register_configs() calls = [] for conf in [utils.GLANCE_REGISTRY_CONF, utils.GLANCE_API_CONF, utils.GLANCE_API_PASTE_INI, utils.GLANCE_REGISTRY_PASTE_INI, utils.HAPROXY_CONF, utils.HTTPS_APACHE_CONF, utils.CEPH_CONF]: calls.append( call(conf, utils.CONFIG_FILES[conf]['hook_contexts']) ) configs.register.assert_has_calls(calls, any_order=True) self.mkdir.assert_called_with('/etc/ceph')
is_ipv6, get_relation_ip, ) from charmhelpers.contrib.openstack.ip import ( canonical_url, PUBLIC, INTERNAL, ADMIN ) from charmhelpers.contrib.openstack.context import ( ADDRESS_TYPES ) from charmhelpers.contrib.charmsupport import nrpe from charmhelpers.contrib.hardening.harden import harden hooks = Hooks() CONFIGS = register_configs() @hooks.hook('install.real') @harden() def install_hook(): status_set('maintenance', 'Executing pre-install') execd_preinstall() src = config('openstack-origin') if (lsb_release()['DISTRIB_CODENAME'] == 'precise' and src == 'distro'): src = 'cloud:precise-folsom' configure_installation_source(src) status_set('maintenance', 'Installing apt packages')
get_iface_for_address, get_ipv6_addr, is_ipv6 ) from charmhelpers.contrib.openstack.ip import ( canonical_url, PUBLIC, INTERNAL, ADMIN ) from charmhelpers.contrib.openstack.context import ( ADDRESS_TYPES ) from charmhelpers.contrib.charmsupport import nrpe hooks = Hooks() CONFIGS = register_configs() @hooks.hook('install.real') def install_hook(): status_set('maintenance', 'Executing pre-install') execd_preinstall() src = config('openstack-origin') if (lsb_release()['DISTRIB_CODENAME'] == 'precise' and src == 'distro'): src = 'cloud:precise-folsom' configure_installation_source(src) status_set('maintenance', 'Installing apt packages') apt_update(fatal=True)
def resume(args): """Resume all the Glance services. @raises Exception if any services fail to start """ resume_unit_helper(register_configs())
def pause(args): """Pause all the Glance services. @raises Exception if any services fail to stop """ pause_unit_helper(register_configs())