Run config-changed hook after git-reinstall action installs from source

This commit is contained in:
Corey Bryant 2015-04-13 23:34:38 +00:00
parent 03055da2d0
commit b3695de6a4
2 changed files with 23 additions and 2 deletions

View File

@ -18,6 +18,10 @@ from cinder_utils import (
git_install,
)
from cinder_hooks import (
config_changed,
)
def git_reinstall():
"""Reinstall from source and restart services.
@ -38,3 +42,4 @@ def git_reinstall():
if __name__ == '__main__':
git_reinstall()
config_changed()

View File

@ -1,10 +1,26 @@
from mock import patch
from mock import patch, MagicMock
import os
os.environ['JUJU_UNIT_NAME'] = 'cinder'
from test_utils import RESTART_MAP
import cinder_utils as utils
# Need to do some early patching to get the module loaded.
_restart_map = utils.restart_map
_register_configs = utils.register_configs
utils.restart_map = MagicMock()
utils.restart_map.return_value = RESTART_MAP
utils.register_configs = MagicMock()
import git_reinstall
# Unpatch it now that its loaded.
utils.restart_map = _restart_map
utils.register_configs = _register_configs
from test_utils import (
CharmTestCase
)
@ -72,7 +88,7 @@ class TestCinderActions(CharmTestCase):
git_install.side_effect = e
traceback = (
"Traceback (most recent call last):\n"
" File \"actions/git_reinstall.py\", line 33, in git_reinstall\n"
" File \"actions/git_reinstall.py\", line 37, in git_reinstall\n"
" git_install(config(\'openstack-origin-git\'))\n"
" File \"/usr/lib/python2.7/dist-packages/mock.py\", line 964, in __call__\n" # noqa
" return _mock_self._mock_call(*args, **kwargs)\n"