示例#1
0
 def test_determine_packages(self, token_cache_pkgs):
     self.config.side_effect = None
     self.os_release.return_value = 'queens'
     token_cache_pkgs.return_value = []
     ex = utils.PACKAGES
     self.assertEqual(set(ex), set(utils.determine_packages()))
     token_cache_pkgs.return_value = ['memcached']
     ex.append('memcached')
     self.assertEqual(set(ex), set(utils.determine_packages()))
 def test_determine_packages(self, token_cache_pkgs):
     self.config.side_effect = None
     self.os_release.return_value = 'queens'
     token_cache_pkgs.return_value = []
     ex = utils.PACKAGES
     self.assertEqual(set(ex), set(utils.determine_packages()))
     token_cache_pkgs.return_value = ['memcached']
     ex.append('memcached')
     self.assertEqual(set(ex), set(utils.determine_packages()))
示例#3
0
def upgrade_charm():
    apt_install(filter_installed_packages(determine_packages()), fatal=True)
    reinstall_paste_ini()
    configure_https()
    update_nrpe_config()
    update_image_location_policy()
    CONFIGS.write_all()
示例#4
0
def upgrade_charm():
    apt_install(filter_installed_packages(determine_packages()), fatal=True)
    packages_removed = remove_old_packages()
    reinstall_paste_ini(force_reinstall=packages_removed)
    configure_https()
    update_nrpe_config()
    update_image_location_policy()
    CONFIGS.write_all()
    if packages_removed:
        juju_log("Package purge detected, restarting services", "INFO")
        for s in services():
            service_restart(s)
def upgrade_charm():
    apt_install(filter_installed_packages(determine_packages()), fatal=True)
    packages_removed = remove_old_packages()
    reinstall_paste_ini(force_reinstall=packages_removed)
    configure_https()
    update_nrpe_config()
    update_image_location_policy()
    CONFIGS.write_all()
    if packages_removed:
        juju_log("Package purge detected, restarting services", "INFO")
        for s in services():
            service_restart(s)
示例#6
0
 def test_openstack_upgrade_not_leader(self, migrate):
     self.config.side_effect = None
     self.config.return_value = 'cloud:precise-havana'
     self.os_release.return_value = 'havana'
     self.is_elected_leader.return_value = False
     self.get_os_codename_install_source.return_value = 'havana'
     configs = MagicMock()
     utils.do_openstack_upgrade(configs)
     self.assertTrue(configs.write_all.called)
     self.apt_install.assert_called_with(utils.determine_packages(),
                                         fatal=True)
     self.apt_upgrade.assert_called_with(options=DPKG_OPTS,
                                         fatal=True, dist=True)
     configs.set_release.assert_called_with(openstack_release='havana')
     self.assertFalse(migrate.called)
示例#7
0
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)
    apt_install(determine_packages(), fatal=True)

    for service in SERVICES:
        service_stop(service)
 def test_openstack_upgrade_not_leader(self, migrate):
     self.config.side_effect = None
     self.config.return_value = 'cloud:precise-havana'
     self.os_release.return_value = 'havana'
     self.is_elected_leader.return_value = False
     self.get_os_codename_install_source.return_value = 'havana'
     configs = MagicMock()
     utils.do_openstack_upgrade(configs)
     self.assertTrue(configs.write_all.called)
     self.apt_install.assert_called_with(utils.determine_packages(),
                                         fatal=True)
     self.apt_upgrade.assert_called_with(options=DPKG_OPTS,
                                         fatal=True, dist=True)
     configs.set_release.assert_called_with(openstack_release='havana')
     self.assertFalse(migrate.called)
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)
    apt_install(determine_packages(), fatal=True)

    for service in SERVICES:
        service_stop(service)
示例#10
0
 def test_openstack_upgrade_rocky(self, migrate):
     self.config.side_effect = None
     self.config.return_value = 'cloud:bionic-rocky'
     self.os_release.return_value = 'rocky'
     self.is_elected_leader.return_value = True
     self.get_os_codename_install_source.return_value = 'rocky'
     self.filter_missing_packages.return_value = ['python-glance']
     configs = MagicMock()
     utils.do_openstack_upgrade(configs)
     self.assertTrue(configs.write_all.called)
     self.apt_install.assert_called_with(utils.determine_packages(),
                                         fatal=True)
     self.apt_upgrade.assert_called_with(options=DPKG_OPTS,
                                         fatal=True, dist=True)
     self.apt_purge.assert_called_with(['python-glance'], fatal=True)
     self.apt_autoremove.assert_called_with(purge=True, fatal=True)
     configs.set_release.assert_called_with(openstack_release='rocky')
     self.assertTrue(migrate.called)
示例#11
0
 def test_openstack_upgrade_rocky(self, migrate):
     self.config.side_effect = None
     self.config.return_value = 'cloud:bionic-rocky'
     self.os_release.return_value = 'rocky'
     self.is_elected_leader.return_value = True
     self.get_os_codename_install_source.return_value = 'rocky'
     self.filter_missing_packages.return_value = ['python-glance']
     configs = MagicMock()
     utils.do_openstack_upgrade(configs)
     self.assertTrue(configs.write_all.called)
     self.apt_install.assert_called_with(utils.determine_packages(),
                                         fatal=True)
     self.apt_upgrade.assert_called_with(options=DPKG_OPTS,
                                         fatal=True, dist=True)
     self.apt_purge.assert_called_with(['python-glance'], fatal=True)
     self.apt_autoremove.assert_called_with(purge=True, fatal=True)
     configs.set_release.assert_called_with(openstack_release='rocky')
     self.assertTrue(migrate.called)
示例#12
0
def upgrade_charm():
    apt_install(filter_installed_packages(determine_packages()), fatal=True)
    configure_https()
    update_nrpe_config()
    CONFIGS.write_all()
示例#13
0
def upgrade_charm():
    apt_install(filter_installed_packages(determine_packages()), fatal=True)
    configure_https()
    update_nrpe_config()
    CONFIGS.write_all()