mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 05:12:45 +00:00
[stable-11] monit: fix check for pending (#11253)
* monit: fix check for pending * add changelog frag * adjust testcases
This commit is contained in:
2
changelogs/fragments/11245-monit-enum.yml
Normal file
2
changelogs/fragments/11245-monit-enum.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- monit - internal state was not reflecting when operation is "pending" in ``monit`` (https://github.com/ansible-collections/community.general/pull/11245).
|
||||
@@ -187,7 +187,7 @@ class Monit(object):
|
||||
else:
|
||||
status = Status.NOT_MONITORED
|
||||
|
||||
if state == 'pending':
|
||||
if state == 'PENDING':
|
||||
status = status.pending()
|
||||
return status
|
||||
|
||||
|
||||
@@ -116,10 +116,10 @@ BASIC_OUTPUT_CASES = [
|
||||
@pytest.mark.parametrize('output, expected', BASIC_OUTPUT_CASES + [
|
||||
('', monit.Status.MISSING),
|
||||
(TEST_OUTPUT % ('Process', 'processY', 'OK'), monit.Status.MISSING),
|
||||
(TEST_OUTPUT % ('Process', 'processX', 'Not Monitored - start pending'), monit.Status.OK),
|
||||
(TEST_OUTPUT % ('Process', 'processX', 'Monitored - stop pending'), monit.Status.NOT_MONITORED),
|
||||
(TEST_OUTPUT % ('Process', 'processX', 'Monitored - restart pending'), monit.Status.OK),
|
||||
(TEST_OUTPUT % ('Process', 'processX', 'Not Monitored - monitor pending'), monit.Status.OK),
|
||||
(TEST_OUTPUT % ('Process', 'processX', 'Not Monitored - start pending'), monit.Status.OK.pending()),
|
||||
(TEST_OUTPUT % ('Process', 'processX', 'Monitored - stop pending'), monit.Status.NOT_MONITORED.pending()),
|
||||
(TEST_OUTPUT % ('Process', 'processX', 'Monitored - restart pending'), monit.Status.OK.pending()),
|
||||
(TEST_OUTPUT % ('Process', 'processX', 'Not Monitored - monitor pending'), monit.Status.OK.pending()),
|
||||
(TEST_OUTPUT % ('Process', 'processX', 'Does not exist'), monit.Status.DOES_NOT_EXIST),
|
||||
(TEST_OUTPUT % ('Process', 'processX', 'Not monitored'), monit.Status.NOT_MONITORED),
|
||||
(TEST_OUTPUT % ('Process', 'processX', 'Running'), monit.Status.OK),
|
||||
|
||||
Reference in New Issue
Block a user