Skip to content

Commit

Permalink
Using server_url and site now instead of site_url.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgetwan committed Oct 23, 2023
1 parent 00e81f8 commit 6f7f665
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 17 deletions.
15 changes: 11 additions & 4 deletions plugins/lookup/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
_terms:
description: complete folder path using tilde as a delimiter
required: True
site_url:
description: site url
server_url:
description: URL of the Checkmk server
required: True
site:
description: site name
required: True
automation_user:
description: automation user for the REST API access
Expand All @@ -40,7 +43,8 @@
attributes: "{{
lookup('checkmk.general.folder',
'~tests',
site_url=server_url + '/' + site,
server_url=server_url,
site=site,
automation_user=automation_user,
automation_secret=automation_secret,
validate_certs=False
Expand All @@ -67,11 +71,14 @@
class LookupModule(LookupBase):
def run(self, terms, variables, **kwargs):
self.set_options(var_options=variables, direct=kwargs)
site_url = self.get_option("site_url")
server_url = self.get_option("server_url")
site = self.get_option("site")
user = self.get_option("automation_user")
secret = self.get_option("automation_secret")
validate_certs = self.get_option("validate_certs")

site_url = server_url + '/' + site

api = CheckMKLookupAPI(
site_url=site_url,
user=user,
Expand Down
18 changes: 13 additions & 5 deletions plugins/lookup/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@
type: boolean
required: False
default: False
site_url:
description: site url
server_url:
description: URL of the Checkmk server
required: True
site:
description: site name
required: True
automation_user:
description: automation user for the REST API access
Expand All @@ -52,7 +55,8 @@
'~',
show_hosts=False,
recursive=True,
site_url=server_url + '/' + site,
server_url=server_url,
site=site,
automation_user=automation_user,
automation_secret=automation_secret,
validate_certs=False
Expand All @@ -70,7 +74,8 @@
'~tests',
show_hosts=True,
recursive=True,
site_url=server_url + '/' + site,
server_url=server_url,
site=site,
automation_user=automation_user,
automation_secret=automation_secret,
validate_certs=False
Expand Down Expand Up @@ -102,11 +107,14 @@ def run(self, terms, variables, **kwargs):
self.set_options(var_options=variables, direct=kwargs)
show_hosts = self.get_option("show_hosts")
recursive = self.get_option("recursive")
site_url = self.get_option("site_url")
server_url = self.get_option("server_url")
site = self.get_option("site")
user = self.get_option("automation_user")
secret = self.get_option("automation_secret")
validate_certs = self.get_option("validate_certs")

site_url = server_url + '/' + site

api = CheckMKLookupAPI(
site_url=site_url,
user=user,
Expand Down
15 changes: 11 additions & 4 deletions plugins/lookup/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
type: boolean
required: False
default: False
site_url:
description: site url
server_url:
description: URL of the Checkmk server
required: True
site:
description: site name
required: True
automation_user:
description: automation user for the REST API access
Expand All @@ -46,7 +49,8 @@
lookup('checkmk.general.host',
'example.com',
effective_attributes=True,
site_url=server_url + '/' + site,
server_url=server_url,
site=site,
automation_user=automation_user,
automation_secret=automation_secret,
validate_certs=False
Expand Down Expand Up @@ -74,11 +78,14 @@ class LookupModule(LookupBase):
def run(self, terms, variables, **kwargs):
self.set_options(var_options=variables, direct=kwargs)
effective_attributes = self.get_option("effective_attributes")
site_url = self.get_option("site_url")
server_url = self.get_option("server_url")
site = self.get_option("site")
user = self.get_option("automation_user")
secret = self.get_option("automation_secret")
validate_certs = self.get_option("validate_certs")

site_url = server_url + '/' + site

api = CheckMKLookupAPI(
site_url=site_url,
user=user,
Expand Down
15 changes: 11 additions & 4 deletions plugins/lookup/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
type: boolean
required: False
default: False
site_url:
description: site url
server_url:
description: URL of the Checkmk server
required: True
site:
description: site name
required: True
automation_user:
description: automation user for the REST API access
Expand All @@ -42,7 +45,8 @@
loop: "{{
lookup('checkmk.general.hosts',
effective_attributes=True,
site_url=server_url + '/' + site,
server_url=server_url,
site=site,
automation_user=automation_user,
automation_secret=automation_secret,
validate_certs=False
Expand Down Expand Up @@ -72,11 +76,14 @@ class LookupModule(LookupBase):
def run(self, terms, variables, **kwargs):
self.set_options(var_options=variables, direct=kwargs)
effective_attributes = self.get_option("effective_attributes")
site_url = self.get_option("site_url")
server_url = self.get_option("server_url")
site = self.get_option("site")
user = self.get_option("automation_user")
secret = self.get_option("automation_secret")
validate_certs = self.get_option("validate_certs")

site_url = server_url + '/' + site

api = CheckMKLookupAPI(
site_url=site_url,
user=user,
Expand Down

0 comments on commit 6f7f665

Please sign in to comment.