diff --git a/actions/git_reinstall.py b/actions/git_reinstall.py index 418291f9..c0c6ec24 100755 --- a/actions/git_reinstall.py +++ b/actions/git_reinstall.py @@ -35,6 +35,7 @@ def git_reinstall(): try: git_install(config('openstack-origin-git')) + config_changed() except: action_set({'traceback': traceback.format_exc()}) action_fail('git-reinstall resulted in an unexpected error') @@ -42,4 +43,3 @@ def git_reinstall(): if __name__ == '__main__': git_reinstall() - config_changed() diff --git a/unit_tests/test_actions_git_reinstall.py b/unit_tests/test_actions_git_reinstall.py index 9b4bee91..a1a7821f 100644 --- a/unit_tests/test_actions_git_reinstall.py +++ b/unit_tests/test_actions_git_reinstall.py @@ -47,22 +47,27 @@ class TestnovaAPIActions(CharmTestCase): @patch.object(git_reinstall, 'action_set') @patch.object(git_reinstall, 'action_fail') @patch.object(git_reinstall, 'git_install') - def test_git_reinstall(self, git_install, action_fail, action_set): + @patch.object(git_reinstall, 'config_changed') + def test_git_reinstall(self, config_changed, git_install, action_fail, + action_set): self.test_config.set('openstack-origin-git', openstack_origin_git) git_reinstall.git_reinstall() git_install.assert_called_with(openstack_origin_git) self.assertTrue(git_install.called) + self.assertTrue(config_changed.called) self.assertFalse(action_set.called) self.assertFalse(action_fail.called) @patch.object(git_reinstall, 'action_set') @patch.object(git_reinstall, 'action_fail') @patch.object(git_reinstall, 'git_install') + @patch.object(git_reinstall, 'config_changed') @patch('charmhelpers.contrib.openstack.utils.config') - def test_git_reinstall_not_configured(self, _config, git_install, - action_fail, action_set): + def test_git_reinstall_not_configured(self, _config, config_changed, + git_install, action_fail, + action_set): _config.return_value = None git_reinstall.git_reinstall() @@ -75,10 +80,12 @@ class TestnovaAPIActions(CharmTestCase): @patch.object(git_reinstall, 'action_set') @patch.object(git_reinstall, 'action_fail') @patch.object(git_reinstall, 'git_install') + @patch.object(git_reinstall, 'config_changed') @patch('traceback.format_exc') @patch('charmhelpers.contrib.openstack.utils.config') - def test_git_reinstall_exception(self, _config, format_exc, git_install, - action_fail, action_set): + def test_git_reinstall_exception(self, _config, format_exc, + config_changed, git_install, action_fail, + action_set): _config.return_value = openstack_origin_git e = OSError('something bad happened') git_install.side_effect = e