Skip to content

Commit

Permalink
Sanity & QA
Browse files Browse the repository at this point in the history
  • Loading branch information
lgetwan committed Jan 24, 2025
1 parent 41130df commit 6eab292
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions plugins/modules/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,23 @@ def post(self):
"update_host_labels": False,
}

if self.params.get("state") in ["new", "fix_all", "monitor_undecided_services", "refresh"]:
if self.params.get("state") in [
"new",
"fix_all",
"monitor_undecided_services",
"refresh"
]:
options["monitor_undecided_services"] = True
if self.params.get("state") in ["remove", "fix_all", "refresh"]:
options["remove_vanished_services"] = True
if self.params.get("state") in ["only_service_labels", "refresh"]:
options["update_service_labels"] = True
if self.params.get("state") in ["new", "fix_all", "only_host_labels", "refresh"]:
if self.params.get("state") in [
"new",
"fix_all",
"only_host_labels",
"refresh"
]:
options["update_host_labels"] = True

data = {
Expand Down Expand Up @@ -358,7 +368,6 @@ def run_module():
servicecompletion = ServiceCompletionAPI(module)
else:
discovery = BulkDiscoveryAPI(module)
print("### Using BulkDiscoveryAPI")
servicecompletion = ServiceCompletionBulkAPI(module)

ver = discovery.getversion()
Expand Down Expand Up @@ -419,7 +428,6 @@ def run_module():
module.fail_json(**result_as_dict(result))

if not single_mode and ver >= CheckmkVersion("2.3.0"):
print("### Using newBulkDiscoveryAPI")
discovery = newBulkDiscoveryAPI(module)

result = wait_for_completion(single_mode, servicecompletion)
Expand Down

0 comments on commit 6eab292

Please sign in to comment.