From 657840476b61adc227ea900cd73ac29fd120a1c3 Mon Sep 17 00:00:00 2001 From: Peter Sabaini Date: Thu, 7 Dec 2023 09:04:20 +0100 Subject: [PATCH] Fix: enable GW services once we have config Closes-Bug: #2045828 Change-Id: Ia473b2793a60172645713b722cbab80dcdbf93b6 --- src/charm.py | 5 +++++ test-requirements.txt | 1 + tests/bundles/focal.yaml | 6 +----- unit_tests/test_ceph_iscsi_charm.py | 3 +++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/charm.py b/src/charm.py index 9ace9cc..2352fa1 100755 --- a/src/charm.py +++ b/src/charm.py @@ -421,6 +421,11 @@ class CephISCSIGatewayCharmBase( self.adapters) logging.info("Rendering config") _render_configs() + # Make sure the gateway services are enabled after rendering the + # configurations and starting those. Those are disabled by + # default in the package. LP: #2045828 + for service_name in self.GW_SERVICES: + ch_host.service_enable(service_name) logging.info("Setting started state") self.peers.announce_ready() self._stored.is_started = True diff --git a/test-requirements.txt b/test-requirements.txt index 552381d..cff01fc 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,3 +11,4 @@ psutil git+https://github.com/openstack-charmers/zaza.git#egg=zaza git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack pyudev # for ceph-* charm unit tests (not mocked?) +protobuf<3.21.0 # https://github.com/juju/python-libjuju/issues/914 diff --git a/tests/bundles/focal.yaml b/tests/bundles/focal.yaml index d95d685..5293c2a 100644 --- a/tests/bundles/focal.yaml +++ b/tests/bundles/focal.yaml @@ -20,8 +20,6 @@ machines: '13': '14': '15': - '16': - '17': applications: ubuntu: charm: cs:ubuntu @@ -32,14 +30,12 @@ applications: - '15' ceph-iscsi: charm: ../../ceph-iscsi.charm - num_units: 4 + num_units: 2 options: gateway-metadata-pool: iscsi-foo-metadata to: - '0' - '1' - - '16' - - '17' ceph-osd: charm: ch:ceph-osd num_units: 6 diff --git a/unit_tests/test_ceph_iscsi_charm.py b/unit_tests/test_ceph_iscsi_charm.py index f4d6c3a..99f08af 100644 --- a/unit_tests/test_ceph_iscsi_charm.py +++ b/unit_tests/test_ceph_iscsi_charm.py @@ -158,6 +158,9 @@ class TestCephISCSIGatewayCharmBase(CharmTestCase): self.test_admin_password = 'rrrrrrrr' self.gwc = MagicMock() self.gwcli_client.GatewayClient.return_value = self.gwc + patch_srv_enable = patch.object(charm.ch_host, 'service_enable') + patch_srv_enable.start() + self.addCleanup(patch_srv_enable.stop) # BEGIN: Workaround until network_get is implemented class _TestingOPSModelBackend(_TestingModelBackend):