From e519e2d3b10396b9facbc042fa4fca2f275fc6e8 Mon Sep 17 00:00:00 2001
From: Frode Nordahl <frode.nordahl@canonical.com>
Date: Thu, 28 Jun 2018 09:40:55 +0200
Subject: [PATCH] Remove uneccessary calls from
 update_all_identity_relation_units

On every call to update_all_identity_relation_units()
apache was reconfigured and all configuration files written.

This was used for the legacy management of self signed
certificates which now has been removed.

Change-Id: I7480575bc06287f6898ce469b420fd63206015e2
---
 hooks/keystone_hooks.py           | 2 --
 unit_tests/test_keystone_hooks.py | 5 -----
 2 files changed, 7 deletions(-)

diff --git a/hooks/keystone_hooks.py b/hooks/keystone_hooks.py
index 23fe49f9..fc8e8a73 100755
--- a/hooks/keystone_hooks.py
+++ b/hooks/keystone_hooks.py
@@ -263,8 +263,6 @@ def db_joined():
 def update_all_identity_relation_units(check_db_ready=True):
     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 986a6e69..1750f18f 100644
--- a/unit_tests/test_keystone_hooks.py
+++ b/unit_tests/test_keystone_hooks.py
@@ -770,7 +770,6 @@ class KeystoneRelationTests(CharmTestCase):
                      call('Firing identity_credentials_changed hook for all '
                           'related services.')]
         hooks.update_all_identity_relation_units(check_db_ready=False)
-        self.assertTrue(configs.write_all.called)
         identity_changed.assert_called_with(
             relation_id='identity-relation:0',
             remote_unit='unit/0')
@@ -786,7 +785,6 @@ class KeystoneRelationTests(CharmTestCase):
         """ 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)
-        self.assertTrue(configs.write_all.called)
         self.assertTrue(self.is_db_ready.called)
         self.log.assert_called_with('Allowed_units list provided and this '
                                     'unit not present', level='INFO')
@@ -800,7 +798,6 @@ class KeystoneRelationTests(CharmTestCase):
         """ 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)
-        self.assertTrue(configs.write_all.called)
         self.assertFalse(self.is_db_ready.called)
         self.log.assert_called_with('Database not yet initialised - '
                                     'deferring identity-relation updates',
@@ -816,7 +813,6 @@ class KeystoneRelationTests(CharmTestCase):
         self.is_elected_leader.return_value = True
         is_db_initialized.return_value = True
         hooks.update_all_identity_relation_units(check_db_ready=False)
-        self.assertTrue(configs.write_all.called)
         self.assertTrue(self.ensure_initial_admin.called)
         # Still updates relations
         self.assertTrue(self.relation_ids.called)
@@ -830,7 +826,6 @@ class KeystoneRelationTests(CharmTestCase):
         self.is_elected_leader.return_value = False
         is_db_initialized.return_value = True
         hooks.update_all_identity_relation_units(check_db_ready=False)
-        self.assertTrue(configs.write_all.called)
         self.assertFalse(self.ensure_initial_admin.called)
         # Still updates relations
         self.assertTrue(self.relation_ids.called)
-- 
GitLab