示例#1
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()
 def test_reinstall_paste_ini_idempotent(self, kv):
     """Ensure that re-running does not re-install files"""
     test_kv = SimpleKV()
     test_kv.set(utils.PASTE_INI_MARKER, True)
     kv.return_value = test_kv
     utils.reinstall_paste_ini()
     self.assertFalse(self.apt_install.called)
 def test_reinstall_paste_ini_idempotent(self, kv):
     """Ensure that re-running does not re-install files"""
     test_kv = SimpleKV()
     test_kv.set(utils.PASTE_INI_MARKER, True)
     kv.return_value = test_kv
     utils.reinstall_paste_ini()
     self.assertFalse(self.apt_install.called)
示例#4
0
 def test_reinstall_paste_ini_fix_upgrade(self, kv, mock_os_release,
                                          mock_exists):
     mock_exists.return_value = False
     mock_os_release.return_value = "queens"
     test_kv = SimpleKV()
     test_kv.set(utils.PASTE_INI_MARKER, True)
     kv.return_value = test_kv
     utils.reinstall_paste_ini()
     self.assertTrue(self.apt_install.called)
示例#5
0
 def test_reinstall_paste_ini_idempotent(self, kv, mock_os_release,
                                         mock_exists):
     """Ensure that re-running does not re-install files"""
     mock_exists.return_value = True
     mock_os_release.return_value = "queens"
     test_kv = SimpleKV()
     test_kv.set(utils.PASTE_INI_MARKER, True)
     kv.return_value = test_kv
     utils.reinstall_paste_ini()
     self.assertFalse(self.apt_install.called)
    def test_reinstall_paste_ini_queens(self, kv, _os, mock_os_release):
        """Ensure that paste.ini files are re-installed"""
        mock_os_release.return_value = 'queens'
        _os.path.exists.return_value = True
        test_kv = SimpleKV()
        kv.return_value = test_kv

        utils.reinstall_paste_ini()
        self.apt_install.assert_called_with(packages=['glance-api'],
                                            options=utils.REINSTALL_OPTIONS,
                                            fatal=True)
示例#7
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)
    def test_reinstall_paste_ini_queens(self, kv, _os, mock_os_release):
        """Ensure that paste.ini files are re-installed"""
        mock_os_release.return_value = 'queens'
        _os.path.exists.return_value = True
        test_kv = SimpleKV()
        kv.return_value = test_kv

        utils.reinstall_paste_ini()
        self.apt_install.assert_called_with(
            packages=['glance-api', 'glance-registry'],
            options=utils.REINSTALL_OPTIONS,
            fatal=True
        )
示例#10
0
 def test_reinstall_paste_ini(self, kv, _os, mock_os_release):
     """Ensure that paste.ini files are re-installed"""
     mock_os_release.return_value = 'pike'
     _os.path.exists.return_value = True
     test_kv = SimpleKV()
     kv.return_value = test_kv
     utils.reinstall_paste_ini()
     self.apt_install.assert_called_with(
         packages=['glance-api', 'glance-registry'],
         options=utils.REINSTALL_OPTIONS,
         fatal=True)
     _os.path.exists.assert_has_calls([
         call(utils.GLANCE_REGISTRY_PASTE),
         call(utils.GLANCE_API_PASTE),
     ])
     _os.remove.assert_has_calls([
         call(utils.GLANCE_REGISTRY_PASTE),
         call(utils.GLANCE_API_PASTE),
     ])
     self.assertTrue(test_kv.get(utils.PASTE_INI_MARKER))
     self.assertTrue(test_kv.flushed)
示例#11
0
 def test_reinstall_paste_ini(self, kv, _os, mock_os_release):
     """Ensure that paste.ini files are re-installed"""
     mock_os_release.return_value = 'pike'
     _os.path.exists.return_value = True
     test_kv = SimpleKV()
     kv.return_value = test_kv
     utils.reinstall_paste_ini()
     self.apt_install.assert_called_with(
         packages=['glance-api', 'glance-registry'],
         options=utils.REINSTALL_OPTIONS,
         fatal=True
     )
     _os.path.exists.assert_has_calls([
         call(utils.GLANCE_REGISTRY_PASTE),
         call(utils.GLANCE_API_PASTE),
     ])
     _os.remove.assert_has_calls([
         call(utils.GLANCE_REGISTRY_PASTE),
         call(utils.GLANCE_API_PASTE),
     ])
     self.assertTrue(test_kv.get(utils.PASTE_INI_MARKER))
     self.assertTrue(test_kv.flushed)
示例#12
0
def upgrade_charm():
    apt_install(filter_installed_packages(determine_packages()), fatal=True)
    reinstall_paste_ini()
    configure_https()
    update_nrpe_config()
    CONFIGS.write_all()