Merge ~lihuiguo/charm-homer-dashboard:bug/1961368 into charm-homer-dashboard:master

Proposed by Linda Guo
Status: Merged
Approved by: Jose Guedez
Approved revision: f540b033373260be5dcffcd7d413243280ed2938
Merged at revision: f1351c736fabfbfded26124abdc6b70f9cbc19af
Proposed branch: ~lihuiguo/charm-homer-dashboard:bug/1961368
Merge into: charm-homer-dashboard:master
Diff against target: 30 lines (+12/-7)
1 file modified
src/charm.py (+12/-7)
Reviewer Review Type Date Requested Status
Jose Guedez (community) Approve
Eric Chen Approve
Review via email: mp+424731@code.launchpad.net

Commit message

handle additional_sites invalid exception

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Eric Chen (eric-chen) :
review: Approve
Revision history for this message
Jose Guedez (jfguedez) wrote :

LGTM +1

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision f1351c736fabfbfded26124abdc6b70f9cbc19af

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/charm.py b/src/charm.py
2index 87faa3a..ea0d767 100755
3--- a/src/charm.py
4+++ b/src/charm.py
5@@ -140,13 +140,18 @@ class HomerDashboardCharm(CharmBase):
6 new_sites = set(site_lns) if site_lns else set()
7 to_del_sites = old_sites - new_sites
8 to_add_sites = new_sites - old_sites
9- for site in to_del_sites:
10- name, url, group = site.split("|")
11- self._delete_application_from_homer(name=name, group=group)
12- for site in to_add_sites:
13- name, url, group = site.split("|")
14- self._add_application_in_homer(name, url, group=group)
15- self._stored.additional_sites = site_lns
16+ try:
17+ for site in to_del_sites:
18+ name, url, group = site.split("|")
19+ self._delete_application_from_homer(name=name, group=group)
20+ for site in to_add_sites:
21+ name, url, group = site.split("|")
22+ self._add_application_in_homer(name, url, group=group)
23+ self._stored.additional_sites = site_lns
24+ self.unit.status = ActiveStatus()
25+ except ValueError as err:
26+ logger.error("Config additional_sites is invalid, {}".format(err))
27+ self.unit.status = BlockedStatus("Config additional_sites invalid")
28
29 def _on_start(self, _):
30 """Start HTTP service."""

Subscribers

People subscribed via source and target branches

to all changes: