def test_do_upgrade(self):
     self.test_config.set('openstack-origin', 'cloud:precise-grizzly')
     self.get_os_codename_install_source.return_value = 'grizzly'
     swift_utils.do_openstack_upgrade(MagicMock())
     self.configure_installation_source.assert_called_with(
         'cloud:precise-grizzly'
     )
     dpkg_opts = [
         '--option', 'Dpkg::Options::=--force-confnew',
         '--option', 'Dpkg::Options::=--force-confdef',
     ]
     self.assertTrue(self.apt_update.called)
     self.apt_install.assert_called_with(
         packages=swift_utils.PACKAGES,
         options=dpkg_opts,
         fatal=True
     )
     services = (swift_utils.ACCOUNT_SVCS + swift_utils.CONTAINER_SVCS +
                 swift_utils.OBJECT_SVCS)
     for service in services:
         self.assertIn(call(service), self.service_restart.call_args_list)
def config_changed():
    if openstack_upgrade_available("swift"):
        do_openstack_upgrade(configs=CONFIGS)
    CONFIGS.write_all()
    save_script_rc()