diff --git a/hooks/keystone_hooks.py b/hooks/keystone_hooks.py index f43c0259..f2bd35d5 100755 --- a/hooks/keystone_hooks.py +++ b/hooks/keystone_hooks.py @@ -372,9 +372,10 @@ def pgsql_db_joined(): def update_all_identity_relation_units(check_db_ready=True): - CONFIGS.write_all() if is_unit_paused_set(): return + CONFIGS.write_all() + configure_https() if check_db_ready and not is_db_ready(): log('Allowed_units list provided and this unit not present', level=INFO) diff --git a/unit_tests/test_keystone_hooks.py b/unit_tests/test_keystone_hooks.py index a19b94bb..f90af736 100644 --- a/unit_tests/test_keystone_hooks.py +++ b/unit_tests/test_keystone_hooks.py @@ -1137,6 +1137,7 @@ class KeystoneRelationTests(CharmTestCase): self.assertFalse(self.migrate_database.called) self.assertFalse(update.called) + @patch.object(hooks, 'configure_https') @patch.object(hooks, 'admin_relation_changed') @patch.object(hooks, 'identity_credentials_changed') @patch.object(hooks, 'identity_changed') @@ -1146,7 +1147,8 @@ class KeystoneRelationTests(CharmTestCase): is_db_initialized, identity_changed, identity_credentials_changed, - admin_relation_changed): + admin_relation_changed, + configure_https): """ Verify all identity relations are updated """ is_db_initialized.return_value = True self.relation_ids.return_value = ['identity-relation:0'] @@ -1168,8 +1170,9 @@ class KeystoneRelationTests(CharmTestCase): admin_relation_changed.assert_called_with('identity-relation:0') self.log.assert_has_calls(log_calls, any_order=True) + @patch.object(hooks, 'configure_https') @patch.object(hooks, 'CONFIGS') - def test_update_all_db_not_ready(self, configs): + def test_update_all_db_not_ready(self, configs, configure_https): """ Verify update identity relations when DB is not ready """ self.is_db_ready.return_value = False hooks.update_all_identity_relation_units(check_db_ready=True) @@ -1179,9 +1182,11 @@ class KeystoneRelationTests(CharmTestCase): 'unit not present', level='INFO') self.assertFalse(self.relation_ids.called) + @patch.object(hooks, 'configure_https') @patch.object(hooks, 'is_db_initialised') @patch.object(hooks, 'CONFIGS') - def test_update_all_db_not_initializd(self, configs, is_db_initialized): + def test_update_all_db_not_initializd(self, configs, is_db_initialized, + configure_https): """ Verify update identity relations when DB is not initialized """ is_db_initialized.return_value = False hooks.update_all_identity_relation_units(check_db_ready=False) @@ -1192,9 +1197,11 @@ class KeystoneRelationTests(CharmTestCase): level='INFO') self.assertFalse(self.relation_ids.called) + @patch.object(hooks, 'configure_https') @patch.object(hooks, 'is_db_initialised') @patch.object(hooks, 'CONFIGS') - def test_update_all_leader(self, configs, is_db_initialized): + def test_update_all_leader(self, configs, is_db_initialized, + configure_https): """ Verify update identity relations when the leader""" self.is_elected_leader.return_value = True is_db_initialized.return_value = True @@ -1204,9 +1211,11 @@ class KeystoneRelationTests(CharmTestCase): # Still updates relations self.assertTrue(self.relation_ids.called) + @patch.object(hooks, 'configure_https') @patch.object(hooks, 'is_db_initialised') @patch.object(hooks, 'CONFIGS') - def test_update_all_not_leader(self, configs, is_db_initialized): + def test_update_all_not_leader(self, configs, is_db_initialized, + configure_https): """ Verify update identity relations when not the leader""" self.is_elected_leader.return_value = False is_db_initialized.return_value = True