def test_restart_map_api_before_frontends(self, subcontext, _exists): self.is_relation_made.return_value = False _exists.return_value = False self._resource_map(network_manager='neutron') _map = utils.restart_map() self.assertTrue(isinstance(_map, OrderedDict)) self.assertEquals(_map, RESTART_MAP)
def test_restart_map_apache24(self, _exists, subcontext): _exists.return_Value = True self._resource_map(network_manager='neutron') _map = utils.restart_map() self.assertTrue('/etc/apache2/sites-available/' 'openstack_https_frontend.conf' in _map) self.assertTrue('/etc/apache2/sites-available/' 'openstack_https_frontend' not in _map)
def test_restart_map_apache24(self, _exists, subcontext): _exists.return_Value = True self._resource_map() _map = utils.restart_map() self.assertTrue('/etc/apache2/sites-available/' 'openstack_https_frontend.conf' in _map) self.assertTrue('/etc/apache2/sites-available/' 'openstack_https_frontend' not in _map)
def test_restart_map_api_before_frontends(self, subcontext, _exists, _os_release): _os_release.return_value = 'icehouse' _exists.return_value = False self._resource_map() _map = utils.restart_map() self.assertTrue(isinstance(_map, OrderedDict)) self.assertEquals(_map, RESTART_MAP)
def test_restart_map_api_ocata_base(self, subcontext, _exists, _os_release): _os_release.return_value = 'ocata' self.os_release.return_value = 'ocata' _exists.return_value = False self.enable_memcache.return_value = False self._resource_map() _map = utils.restart_map(actual_services=False) self.assertIsInstance(_map, OrderedDict) self.assertEqual(_map, RESTART_MAP_OCATA_BASE)
def test_restart_map_api_before_frontends_icehouse(self, subcontext, _exists, _os_release): _os_release.return_value = 'icehouse' self.os_release.return_value = 'icehouse' _exists.return_value = False self.enable_memcache.return_value = False self._resource_map() _map = utils.restart_map() self.assertIsInstance(_map, OrderedDict) self.assertEqual(_map, RESTART_MAP_ICEHOUSE)
f = os.path.join(_files, f) if os.path.isfile(f): log('Installing %s to /usr/bin' % f) shutil.copy2(f, '/usr/bin') [open_port(port) for port in determine_ports()] msg = 'Disabling services into db relation joined' log(msg) status_set('maintenance', msg) disable_services() cmd_all_services('stop') @hooks.hook('config-changed') @service_guard(guard_map(), CONFIGS, active=config('service-guard')) @restart_on_change(restart_map(), stopstart=True) @harden() def config_changed(): # neutron-server runs if < juno. Neutron-server creates mysql tables # which will subsequently cause db migratoins to fail if >= juno. # Disable neutron-server if >= juno if os_release('nova-common') >= 'juno': with open('/etc/init/neutron-server.override', 'wb') as out: out.write('manual\n') if config('prefer-ipv6'): status_set('maintenance', 'configuring ipv6') setup_ipv6() sync_db_with_multi_ipv6_addresses(config('database'), config('database-user'), relation_prefix='nova')
for f in os.listdir(_files): f = os.path.join(_files, f) if os.path.isfile(f): log('Installing %s to /usr/bin' % f) shutil.copy2(f, '/usr/bin') [open_port(port) for port in determine_ports()] msg = 'Disabling services into db relation joined' log(msg) status_set('maintenance', msg) disable_services() cmd_all_services('stop') @hooks.hook('config-changed') @service_guard(guard_map(), CONFIGS, active=config('service-guard')) @restart_on_change(restart_map(), stopstart=True) 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'), relation_prefix='nova') global CONFIGS if git_install_requested(): status_set('maintenance', 'Running Git install') if config_value_changed('openstack-origin-git'): git_install(config('openstack-origin-git')) elif not config('action-managed-upgrade'): if openstack_upgrade_available('nova-common'):
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE) output = process.communicate()[0] configure_installation_source(config('openstack-origin')) apt_update() apt_install(determine_packages(), fatal=True) _files = os.path.join(charm_dir(), 'files') if os.path.isdir(_files): for f in os.listdir(_files): f = os.path.join(_files, f) log('Installing %s to /usr/bin' % f) shutil.copy2(f, '/usr/bin') [open_port(port) for port in determine_ports()] @hooks.hook('config-changed') @restart_on_change(restart_map()) def config_changed(): if openstack_upgrade_available('nova-common'): do_openstack_upgrade(configs=CONFIGS) save_script_rc() configure_https() CONFIGS.write_all() @hooks.hook('amqp-relation-joined') def amqp_joined(relation_id=None): relation_set(relation_id=relation_id, username=config('rabbit-user'), vhost=config('rabbit-vhost')) @hooks.hook('amqp-relation-changed') @restart_on_change(restart_map())