Merge lp:~mitchburton/landscape-charm/reorder_additional_config into lp:landscape-charm

Proposed by Mitch Burton
Status: Merged
Approved by: Mitch Burton
Approved revision: 435
Merged at revision: 435
Proposed branch: lp:~mitchburton/landscape-charm/reorder_additional_config
Merge into: lp:landscape-charm
Diff against target: 51 lines (+12/-11)
2 files modified
src/charm.py (+10/-10)
tests/test_charm.py (+2/-1)
To merge this branch: bzr merge lp:~mitchburton/landscape-charm/reorder_additional_config
Reviewer Review Type Date Requested Status
Kevin Nasto Approve
Review via email: mp+438829@code.launchpad.net

Commit message

do additional config override at start of config-changed

To post a comment you must log in.
Revision history for this message
Kevin Nasto (silverdrake11) wrote :

LGTM +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/charm.py'
2--- src/charm.py 2023-03-10 23:21:07 +0000
3+++ src/charm.py 2023-03-13 21:38:50 +0000
4@@ -148,6 +148,16 @@
5 def _on_config_changed(self, _) -> None:
6 prev_status = self.unit.status
7
8+ # Update additional configuration
9+ deployment_mode = self.model.config.get("deployment_mode")
10+ update_service_conf({"global": {"deployment-mode": deployment_mode}})
11+
12+ configure_for_deployment_mode(deployment_mode)
13+
14+ additional_config = self.model.config.get("additional_service_config")
15+ if additional_config:
16+ merge_service_conf(additional_config)
17+
18 # Write the config-provided SSL certificate, if it exists.
19 config_ssl_cert = self.model.config["ssl_cert"]
20
21@@ -217,16 +227,6 @@
22 if isinstance(prev_status, BlockedStatus):
23 self.unit.status = prev_status
24
25- # Update additional configuration
26- deployment_mode = self.model.config.get("deployment_mode")
27- update_service_conf({"global": {"deployment-mode": deployment_mode}})
28-
29- configure_for_deployment_mode(deployment_mode)
30-
31- additional_config = self.model.config.get("additional_service_config")
32- if additional_config:
33- merge_service_conf(additional_config)
34-
35 self._update_ready_status(restart_services=True)
36
37 def _on_install(self, event: InstallEvent) -> None:
38
39=== modified file 'tests/test_charm.py'
40--- tests/test_charm.py 2023-03-10 23:21:07 +0000
41+++ tests/test_charm.py 2023-03-13 21:38:50 +0000
42@@ -480,7 +480,8 @@
43 ),
44 )
45
46- def test_on_manual_db_config_change_block_if_error(self):
47+ @patch("charm.update_service_conf")
48+ def test_on_manual_db_config_change_block_if_error(self, _):
49 """
50 If the schema migration doesn't go through on a manual config change,
51 then block unit status

Subscribers

People subscribed via source and target branches

to all changes: