def test_determine_packages_subset(self, service_enabled): 'It determines packages required for a subset of enabled services' service_enabled.side_effect = self.svc_enabled self.test_config.set('openstack-origin', 'cloud:xenial-newton') self.os_release.return_value = 'newton' self.token_cache_pkgs.return_value = ['memcached'] self.test_config.set('enabled-services', 'api') pkgs = cinder_utils.determine_packages() common = cinder_utils.COMMON_PACKAGES self.assertEqual( sorted(pkgs), sorted(common + cinder_utils.API_PACKAGES + ['memcached'])) self.test_config.set('enabled-services', 'volume') pkgs = cinder_utils.determine_packages() common = cinder_utils.COMMON_PACKAGES self.assertEqual( sorted(pkgs), sorted(common + cinder_utils.VOLUME_PACKAGES + ['memcached'])) self.test_config.set('enabled-services', 'api,scheduler') pkgs = cinder_utils.determine_packages() common = cinder_utils.COMMON_PACKAGES self.assertEqual( sorted(pkgs), sorted(common + cinder_utils.API_PACKAGES + ['memcached'] + cinder_utils.SCHEDULER_PACKAGES))
def test_determine_packages_all(self, service_enabled): 'It determines all packages required when all services enabled' service_enabled.return_value = True pkgs = cinder_utils.determine_packages() self.assertEqual( sorted(pkgs), sorted(cinder_utils.COMMON_PACKAGES + cinder_utils.VOLUME_PACKAGES + cinder_utils.API_PACKAGES + cinder_utils.SCHEDULER_PACKAGES))
def test_determine_packages_all(self, service_enabled): '''It determines all packages required when all services enabled''' service_enabled.return_value = True pkgs = cinder_utils.determine_packages() self.assertEquals(sorted(pkgs), sorted(cinder_utils.COMMON_PACKAGES + cinder_utils.VOLUME_PACKAGES + cinder_utils.API_PACKAGES + cinder_utils.SCHEDULER_PACKAGES))
def test_determine_packages_subset(self, service_enabled): '''It determines packages required for a subset of enabled services''' service_enabled.side_effect = self.svc_enabled self.test_config.set('enabled-services', 'api') pkgs = cinder_utils.determine_packages() common = cinder_utils.COMMON_PACKAGES self.assertEquals(sorted(pkgs), sorted(common + cinder_utils.API_PACKAGES)) self.test_config.set('enabled-services', 'volume') pkgs = cinder_utils.determine_packages() common = cinder_utils.COMMON_PACKAGES self.assertEquals(sorted(pkgs), sorted(common + cinder_utils.VOLUME_PACKAGES)) self.test_config.set('enabled-services', 'api,scheduler') pkgs = cinder_utils.determine_packages() common = cinder_utils.COMMON_PACKAGES self.assertEquals(sorted(pkgs), sorted(common + cinder_utils.API_PACKAGES + cinder_utils.SCHEDULER_PACKAGES))
def upgrade_charm(): apt_install(filter_installed_packages(determine_packages()), fatal=True) packages_removed = remove_old_packages() for rel_id in relation_ids('amqp'): amqp_joined(relation_id=rel_id) update_nrpe_config() scrub_old_style_ceph() if packages_removed: juju_log("Package purge detected, restarting services") for s in services(): service_restart(s)
def test_determine_packages_subset(self, git_requested, service_enabled): 'It determines packages required for a subset of enabled services' git_requested.return_value = False service_enabled.side_effect = self.svc_enabled self.test_config.set('enabled-services', 'api') pkgs = cinder_utils.determine_packages() common = cinder_utils.COMMON_PACKAGES self.assertEquals(sorted(pkgs), sorted(common + cinder_utils.API_PACKAGES)) self.test_config.set('enabled-services', 'volume') pkgs = cinder_utils.determine_packages() common = cinder_utils.COMMON_PACKAGES self.assertEquals(sorted(pkgs), sorted(common + cinder_utils.VOLUME_PACKAGES)) self.test_config.set('enabled-services', 'api,scheduler') pkgs = cinder_utils.determine_packages() common = cinder_utils.COMMON_PACKAGES self.assertEquals( sorted(pkgs), sorted(common + cinder_utils.API_PACKAGES + cinder_utils.SCHEDULER_PACKAGES))
def test_determine_packages_all_rocky(self, service_enabled): 'Check python3 packages are installed @ rocky' service_enabled.return_value = True self.os_release.return_value = 'rocky' pkgs = cinder_utils.determine_packages() self.assertEqual( sorted(pkgs), sorted([p for p in cinder_utils.COMMON_PACKAGES if not p.startswith('python-')] + cinder_utils.VOLUME_PACKAGES + cinder_utils.API_PACKAGES + cinder_utils.SCHEDULER_PACKAGES + cinder_utils.PY3_PACKAGES))
def test_determine_packages_all_rocky(self, service_enabled): 'Check python3 packages are installed @ rocky' service_enabled.return_value = True self.os_release.return_value = 'rocky' pkgs = cinder_utils.determine_packages() self.assertEqual( sorted(pkgs), sorted([ p for p in cinder_utils.COMMON_PACKAGES if not p.startswith('python-') ] + cinder_utils.VOLUME_PACKAGES + cinder_utils.API_PACKAGES + cinder_utils.SCHEDULER_PACKAGES + cinder_utils.PY3_PACKAGES + cinder_utils.PY3_API_PACKAGES))
def install(): status_set('maintenance', 'Executing pre-install') execd_preinstall() conf = config() src = conf['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() apt_install(determine_packages(), fatal=True) if run_in_apache(): disable_package_apache_site()
def install(): status_set('maintenance', 'Executing pre-install') execd_preinstall() conf = config() src = conf['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() apt_install(determine_packages(), fatal=True) status_set('maintenance', 'Git install') git_install(config('openstack-origin-git'))
def upgrade_charm(): apt_install(filter_installed_packages(determine_packages()), fatal=True) packages_removed = remove_old_packages() for rel_id in relation_ids('amqp'): amqp_joined(relation_id=rel_id) update_nrpe_config() scrub_old_style_ceph() if packages_removed: juju_log("Package purge detected, restarting services") for s in services(): service_restart(s) # call the policy overrides handler which will install any policy overrides maybe_do_policyd_overrides( os_release('cinder-common'), 'cinder', restart_handler=lambda: service_restart('cinder-api'))
def install(): execd_preinstall() conf = config() src = conf['openstack-origin'] if (lsb_release()['DISTRIB_CODENAME'] == 'precise' and src == 'distro'): src = 'cloud:precise-folsom' configure_installation_source(src) apt_update() apt_install(determine_packages(), fatal=True) if (service_enabled('volume') and conf['block-device'] not in [None, 'None', 'none']): bdev = ensure_block_device(conf['block-device']) juju_log('Located valid block device: %s' % bdev) if conf['overwrite'] in ['true', 'True', True]: juju_log('Ensuring block device is clean: %s' % bdev) clean_storage(bdev) prepare_lvm_storage(bdev, conf['volume-group'])
def install(): status_set('maintenance', 'Executing pre-install') execd_preinstall() conf = config() src = conf['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() apt_install(determine_packages(), fatal=True) if run_in_apache(): disable_package_apache_site() # call the policy overrides handler which will install any policy overrides maybe_do_policyd_overrides( os_release('cinder-common'), 'cinder', restart_handler=lambda: service_restart('cinder-api'))
def upgrade_charm(): apt_install(determine_packages(), fatal=True) for rel_id in relation_ids('amqp'): amqp_joined(relation_id=rel_id) update_nrpe_config()