Merge ~mertkirpici/charm-nrpe:lp/2008046 into charm-nrpe:master

Proposed by Mert Kirpici
Status: Merged
Approved by: Ramesh Sattaru
Approved revision: db685e811d208dfd2856266d61a12e9040903e36
Merged at revision: 09b1f95ec5490e616376b53eb16fec4e4754d1d1
Proposed branch: ~mertkirpici/charm-nrpe:lp/2008046
Merge into: charm-nrpe:master
Diff against target: 128 lines (+27/-23)
8 files modified
actions/ack-reboot.py (+1/-1)
tests/functional/tests/bundles/base.yaml (+3/-10)
tests/functional/tests/bundles/overlays/bionic.yaml.j2 (+2/-2)
tests/functional/tests/bundles/overlays/focal.yaml.j2 (+2/-2)
tests/functional/tests/bundles/overlays/jammy.yaml.j2 (+2/-2)
tests/functional/tests/bundles/overlays/xenial.yaml.j2 (+0/-3)
tests/functional/tests/nrpe_tests.py (+16/-0)
tests/functional/tests/tests.yaml (+1/-3)
Reviewer Review Type Date Requested Status
Ramesh Sattaru (community) Approve
Erhan Sunar (community) Approve
🤖 prod-jenkaas-bootstack (community) continuous-integration Approve
Review via email: mp+437882@code.launchpad.net

Commit message

Close LP #2008046

Description of the change

actions/ack-reboot: conform to new services api

A factory method was introduced in 940fa803a4da7268679e4b446069fc4cf28d45cf the module level object was replaced with that. We need to use it in the action code as well.

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
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
Erhan Sunar (esunar) :
review: Approve
Revision history for this message
Ramesh Sattaru (rameshcan) :
review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 09b1f95ec5490e616376b53eb16fec4e4754d1d1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/actions/ack-reboot.py b/actions/ack-reboot.py
2index 13906bc..198f171 100755
3--- a/actions/ack-reboot.py
4+++ b/actions/ack-reboot.py
5@@ -25,7 +25,7 @@ import services # noqa: E402
6
7 if hookenv.config("reboot"):
8 reboot_time = nrpe_helpers.set_known_reboot_time()
9- services.manager.reconfigure_services("nrpe-config")
10+ services.get_manager().reconfigure_services("nrpe-config")
11 hookenv.action_set(
12 {"message": "known reboot time updated to {}".format(reboot_time)}
13 )
14diff --git a/tests/functional/tests/bundles/base.yaml b/tests/functional/tests/bundles/base.yaml
15index 01fd127..c01fa2e 100644
16--- a/tests/functional/tests/bundles/base.yaml
17+++ b/tests/functional/tests/bundles/base.yaml
18@@ -3,22 +3,15 @@ applications:
19 rabbitmq-server:
20 charm: ch:rabbitmq-server
21 num_units: 1
22- # Note(sudeephb): Ubuntu lxd deployments on bionic/xenial hosts are
23- # not working, issue related to this - https://github.com/lxc/lxd/issues/10231
24- # (see recent comments/references on the issue). Until the lxd/public-cloud team
25- # come up with a permanent solution, we can deploy ubuntu bionic and xenial containers
26- # on focal hosts. After the issue is fixed, the `container` application can be
27- # deployed on the rabbitmq-server host and this ubuntu host can be removed.
28- ubuntu:
29- charm: ch:ubuntu
30- num_units: 1
31+ constraints: root-disk=8G cores=2
32 container:
33 charm: ch:ubuntu
34 num_units: 1
35- to: ["lxd:ubuntu/0"]
36+ to: ["lxd:rabbitmq-server/0"]
37 nagios:
38 charm: ch:nagios
39 num_units: 1
40+ series: bionic
41 relations:
42 - - rabbitmq-server:nrpe-external-master
43 - nrpe:nrpe-external-master
44diff --git a/tests/functional/tests/bundles/overlays/bionic.yaml.j2 b/tests/functional/tests/bundles/overlays/bionic.yaml.j2
45index 7702413..479b289 100644
46--- a/tests/functional/tests/bundles/overlays/bionic.yaml.j2
47+++ b/tests/functional/tests/bundles/overlays/bionic.yaml.j2
48@@ -1,4 +1,4 @@
49 series: bionic
50 applications:
51- ubuntu:
52- series: focal
53+ rabbitmq-server:
54+ channel: 3.8/stable
55diff --git a/tests/functional/tests/bundles/overlays/focal.yaml.j2 b/tests/functional/tests/bundles/overlays/focal.yaml.j2
56index 44f4b11..daee4ef 100644
57--- a/tests/functional/tests/bundles/overlays/focal.yaml.j2
58+++ b/tests/functional/tests/bundles/overlays/focal.yaml.j2
59@@ -1,4 +1,4 @@
60 series: focal
61 applications:
62- nagios:
63- series: bionic
64+ rabbitmq-server:
65+ channel: 3.8/stable
66diff --git a/tests/functional/tests/bundles/overlays/jammy.yaml.j2 b/tests/functional/tests/bundles/overlays/jammy.yaml.j2
67index a151c85..6e8266b 100644
68--- a/tests/functional/tests/bundles/overlays/jammy.yaml.j2
69+++ b/tests/functional/tests/bundles/overlays/jammy.yaml.j2
70@@ -1,4 +1,4 @@
71 series: jammy
72 applications:
73- nagios:
74- series: bionic
75+ rabbitmq-server:
76+ channel: 3.9/stable
77diff --git a/tests/functional/tests/bundles/overlays/xenial.yaml.j2 b/tests/functional/tests/bundles/overlays/xenial.yaml.j2
78index 56a37e9..2cfb90e 100644
79--- a/tests/functional/tests/bundles/overlays/xenial.yaml.j2
80+++ b/tests/functional/tests/bundles/overlays/xenial.yaml.j2
81@@ -1,4 +1 @@
82 series: xenial
83-applications:
84- ubuntu:
85- series: focal
86diff --git a/tests/functional/tests/nrpe_tests.py b/tests/functional/tests/nrpe_tests.py
87index d58ce79..314ffc0 100644
88--- a/tests/functional/tests/nrpe_tests.py
89+++ b/tests/functional/tests/nrpe_tests.py
90@@ -356,3 +356,19 @@ class TestNrpe(TestBase):
91 result = model.run_on_unit(unit, cmdline)
92 self.assertEqual(result["Code"], "0")
93 return set(result["Stdout"].splitlines())
94+
95+
96+class TestNrpeActions(TestBase):
97+ """Class for charm actions."""
98+
99+ def test_01_ack_reboot(self):
100+ """Test the ack-reboot action."""
101+ uptime = (
102+ model.run_on_leader(self.application_name, "uptime --since")
103+ .get("Stdout")
104+ .strip()
105+ )
106+ action = model.run_action_on_leader(self.application_name, "ack-reboot")
107+ message = action.data["results"].get("message")
108+ self.assertIsNotNone(message)
109+ self.assertEqual(message, "known reboot time updated to {}".format(uptime))
110diff --git a/tests/functional/tests/tests.yaml b/tests/functional/tests/tests.yaml
111index 86fd720..b476f5a 100644
112--- a/tests/functional/tests/tests.yaml
113+++ b/tests/functional/tests/tests.yaml
114@@ -8,6 +8,7 @@ smoke_bundles:
115 - focal
116 tests:
117 - tests.nrpe_tests.TestNrpe
118+ - tests.nrpe_tests.TestNrpeActions
119 target_deploy_status:
120 container:
121 workload-status: active
122@@ -15,6 +16,3 @@ target_deploy_status:
123 ubuntu:
124 workload-status: active
125 workload-status-message-prefix: ""
126-tests_options:
127- force_deploy:
128- - jammy # https://github.com/juju-solutions/charm-ubuntu/issues/44

Subscribers

People subscribed via source and target branches

to all changes: