Skip to content

Commit 4744d6b

Browse files
committed
Initial commit
1 parent 86f4a0c commit 4744d6b

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

plugins/modules/discovery.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
description: The action to perform during discovery.
4141
type: str
4242
default: new
43-
choices: [new, remove, fix_all, refresh, tabula_rasa, only_host_labels, update_service_labels, monitor_undecided_services]
43+
choices: [new, remove, fix_all, refresh, tabula_rasa, only_host_labels, only_service_labels, monitor_undecided_services]
4444
do_full_scan:
4545
description: The option whether to perform a full scan or not. (Bulk mode only).
4646
type: bool
@@ -255,7 +255,7 @@ def post(self):
255255
options["monitor_undecided_services"] = True
256256
if self.params.get("state") in ["remove", "fix_all"]:
257257
options["remove_vanished_services"] = True
258-
if self.params.get("state") in ["update_service_labels"]:
258+
if self.params.get("state") in ["only_service_labels"]:
259259
options["update_service_labels"] = True
260260
if self.params.get("state") in ["new", "fix_all", "only_host_labels"]:
261261
options["update_host_labels"] = True
@@ -336,7 +336,7 @@ def run_module():
336336
"refresh",
337337
"tabula_rasa",
338338
"only_host_labels",
339-
"update_service_labels",
339+
"only_service_labels",
340340
"monitor_undecided_services",
341341
],
342342
),
@@ -400,7 +400,7 @@ def run_module():
400400
module.params["state"] = "refresh"
401401

402402
if module.params.get("state") in [
403-
"update_service_labels",
403+
"only_service_labels",
404404
"monitor_undecided_services",
405405
]:
406406
if ver < CheckmkVersion("2.3.0"):
@@ -426,7 +426,7 @@ def run_module():
426426
module.fail_json(**result_as_dict(result))
427427
if module.params.get(
428428
"state"
429-
) == "update_service_labels" and ver < CheckmkVersion("2.3.0p3"):
429+
) == "only_service_labels" and ver < CheckmkVersion("2.3.0p3"):
430430
result = RESULT(
431431
http_code=0,
432432
msg="State can only be used in bulk mode",

tests/integration/targets/discovery/tasks/test.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
automation_user: "{{ checkmk_var_automation_user }}"
7373
automation_secret: "{{ checkmk_var_automation_secret }}"
7474
host_name: "{{ item.name }}"
75-
state: "update_service_labels"
75+
state: "only_service_labels"
7676
delegate_to: localhost
7777
run_once: true # noqa run-once[task]
7878
loop: "{{ checkmk_hosts }}"
@@ -95,19 +95,17 @@
9595
failed_when: "'State is not supported before 2.3.0' not in monitorundecidedservices_output.msg"
9696
when: "not '2.3.0' in outer_item.version"
9797

98-
- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Update service labels. (Should fail in 2.3.0)"
98+
- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Update service labels."
9999
discovery:
100100
server_url: "{{ checkmk_var_server_url }}"
101101
site: "{{ outer_item.site }}"
102102
automation_user: "{{ checkmk_var_automation_user }}"
103103
automation_secret: "{{ checkmk_var_automation_secret }}"
104104
host_name: "{{ item.name }}"
105-
state: "update_service_labels"
105+
state: "only_service_labels"
106106
delegate_to: localhost
107107
run_once: true # noqa run-once[task]
108108
loop: "{{ checkmk_hosts }}"
109-
register: stableupdateservicelabels_output
110-
failed_when: "'State can only be used in bulk mode' not in stableupdateservicelabels_output.msg"
111109
when: "'2.3.0' in outer_item.version"
112110

113111
- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Monitor undecided services. (Should fail in 2.3.0)"
@@ -245,7 +243,7 @@
245243
automation_user: "{{ checkmk_var_automation_user }}"
246244
automation_secret: "{{ checkmk_var_automation_secret }}"
247245
hosts: "{{ checkmk_host_names }}"
248-
state: "update_service_labels"
246+
state: "only_service_labels"
249247
bulk_size: 5
250248
delegate_to: localhost
251249
register: bulkupdateservicelabels_output
@@ -273,7 +271,7 @@
273271
automation_user: "{{ checkmk_var_automation_user }}"
274272
automation_secret: "{{ checkmk_var_automation_secret }}"
275273
hosts: "{{ checkmk_host_names }}"
276-
state: "update_service_labels"
274+
state: "only_service_labels"
277275
bulk_size: 5
278276
delegate_to: localhost
279277
when: "'2.3.0' in outer_item.version"

0 commit comments

Comments
 (0)