Normalizing charm config (finally). Adding additional action upgrade config-changed test.

This commit is contained in:
David Della Vecchia 2015-08-31 16:25:22 +00:00
parent 142b41be23
commit dd1bb5a8d5
3 changed files with 16 additions and 5 deletions

View File

@ -48,6 +48,7 @@ def openstack_upgrade():
try:
do_openstack_upgrade(configs=CONFIGS)
# NOTE(jamespage) tell any storage-backends we just upgraded
for rid in relation_ids('storage-backend'):
relation_set(relation_id=rid,
upgrade_nonce=uuid.uuid4())

View File

@ -287,8 +287,8 @@ options:
default: False
description: |
If True enables openstack upgrades for this charm via juju actions.
You will still need to set the config variable for the openstack version
but instead of an upgrade running automatically across all units, it will
wait for you to execute the openstack-upgrade action for this charm on each
unit. If False it will revert to existing behavior of upgrading all units on
config change.
You will still need to set openstack-origin to the new repository but
instead of an upgrade running automatically across all units, it will
wait for you to execute the openstack-upgrade action for this charm on
each unit. If False it will revert to existing behavior of upgrading
all units on config change.

View File

@ -226,6 +226,16 @@ class TestChangedHooks(CharmTestCase):
self.assertFalse(self.do_openstack_upgrade.called)
self.assertTrue(conf_https.called)
@patch.object(hooks, 'git_install_requested')
def test_config_changed_with_openstack_upgrade_action(self, git_requested):
git_requested.return_value = False
self.openstack_upgrade_available.return_value = True
self.test_config.set('action-managed-upgrade', True)
hooks.hooks.execute(['hooks/config-changed'])
self.assertFalse(self.do_openstack_upgrade.called)
def test_db_changed(self):
'It writes out cinder.conf on db changed'
self.relation_get.return_value = 'cinder/0 cinder/1'