Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr/239 #242

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 115 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,82 +86,179 @@ jobs:
${{ contains(fromJson(
'["stable-2.9", "stable-2.10", "stable-2.11"]'
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}) - director ${{ matrix.icinga_director }}
strategy:
fail-fast: false
matrix:
icinga_director:
- 1.8.1
- 1.11.0
ansible:
- devel
# - milestone
python:
- '2.7'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
exclude:
- ansible: devel
python: '2.7'
- ansible: devel
python: '3.6'
- '3.12'
include:
# Add new versions announced in
# https://github.com/ansible-collections/news-for-maintainers in a timely manner,
# consider dropping testing against EOL versions and versions you don't support.
# ansible-core 2.13
- ansible: stable-2.13
# ansible-core 2.14
- ansible: stable-2.14
python: '2.7'
- ansible: stable-2.13
icinga_director: 1.8.1
- ansible: stable-2.14
python: '3.5'
- ansible: stable-2.13
icinga_director: 1.8.1
- ansible: stable-2.14
python: '3.6'
- ansible: stable-2.13
icinga_director: 1.8.1
- ansible: stable-2.14
python: '3.7'
- ansible: stable-2.13
icinga_director: 1.8.1
- ansible: stable-2.14
python: '3.8'
- ansible: stable-2.13
icinga_director: 1.8.1
- ansible: stable-2.14
python: '3.9'
- ansible: stable-2.13
icinga_director: 1.8.1
- ansible: stable-2.14
python: '3.10'
# ansible-core 2.14
icinga_director: 1.8.1
- ansible: stable-2.14
python: '3.11'
icinga_director: 1.8.1
# ansible-core 2.15
- ansible: stable-2.15
python: '2.7'
icinga_director: 1.8.1
- ansible: stable-2.15
python: '3.5'
icinga_director: 1.8.1
- ansible: stable-2.15
python: '3.6'
icinga_director: 1.8.1
- ansible: stable-2.15
python: '3.7'
icinga_director: 1.8.1
- ansible: stable-2.15
python: '3.8'
icinga_director: 1.8.1
- ansible: stable-2.15
python: '3.9'
icinga_director: 1.8.1
- ansible: stable-2.15
python: '3.10'
icinga_director: 1.8.1
- ansible: stable-2.15
python: '3.11'
icinga_director: 1.8.1
# ansible-core 2.16
- ansible: stable-2.16
python: '2.7'
icinga_director: 1.8.1
- ansible: stable-2.16
python: '3.6'
icinga_director: 1.8.1
- ansible: stable-2.16
python: '3.7'
icinga_director: 1.8.1
- ansible: stable-2.16
python: '3.8'
icinga_director: 1.8.1
- ansible: stable-2.16
python: '3.9'
icinga_director: 1.8.1
- ansible: stable-2.16
python: '3.10'
icinga_director: 1.8.1
- ansible: stable-2.16
python: '3.11'
icinga_director: 1.8.1
- ansible: stable-2.16
python: '3.12'
icinga_director: 1.8.1
- ansible: stable-2.14
python: '2.7'
icinga_director: 1.11.0
- ansible: stable-2.14
python: '3.5'
icinga_director: 1.11.0
- ansible: stable-2.14
python: '3.6'
icinga_director: 1.11.0
- ansible: stable-2.14
python: '3.7'
icinga_director: 1.11.0
- ansible: stable-2.14
python: '3.8'
icinga_director: 1.11.0
- ansible: stable-2.14
python: '3.9'
icinga_director: 1.11.0
- ansible: stable-2.14
python: '3.10'
icinga_director: 1.11.0
- ansible: stable-2.14
python: '3.11'
icinga_director: 1.11.0
# ansible-core 2.15
- ansible: stable-2.15
python: '2.7'
icinga_director: 1.11.0
- ansible: stable-2.15
python: '3.5'
icinga_director: 1.11.0
- ansible: stable-2.15
python: '3.6'
icinga_director: 1.11.0
- ansible: stable-2.15
python: '3.7'
icinga_director: 1.11.0
- ansible: stable-2.15
python: '3.8'
icinga_director: 1.11.0
- ansible: stable-2.15
python: '3.9'
icinga_director: 1.11.0
- ansible: stable-2.15
python: '3.10'
icinga_director: 1.11.0
- ansible: stable-2.15
python: '3.11'
icinga_director: 1.11.0
# ansible-core 2.16
- ansible: stable-2.16
python: '2.7'
icinga_director: 1.11.0
- ansible: stable-2.16
python: '3.6'
icinga_director: 1.11.0
- ansible: stable-2.16
python: '3.7'
icinga_director: 1.11.0
- ansible: stable-2.16
python: '3.8'
icinga_director: 1.11.0
- ansible: stable-2.16
python: '3.9'
icinga_director: 1.11.0
- ansible: stable-2.16
python: '3.10'
icinga_director: 1.11.0
- ansible: stable-2.16
python: '3.11'
icinga_director: 1.11.0
- ansible: stable-2.16
python: '3.12'
icinga_director: 1.11.0
services:
icinga:
image: ghcr.io/telekom-mms/icinga2:director-1.8.1@sha256:bf9205d41607f1641146e870644af0529338d06a9b360737bdf56a3f951cc28b
image: ghcr.io/telekom-mms/icinga2:director-${{ matrix.icinga_director }}
ports:
- 80:80
steps:
Expand Down
14 changes: 10 additions & 4 deletions plugins/modules/icinga_service_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@
# Icinga2 API class
#
class ServiceApplyRule(Icinga2APIObject):
find_by_parameter = None

def __init__(self, module, data):
path = "/service"
super(ServiceApplyRule, self).__init__(module, path, data)
Expand All @@ -260,18 +262,22 @@ def exists(self):
if ret["code"] == 200:
for existing_rule in ret["data"]["objects"]:
if existing_rule["object_name"] == self.data["object_name"]:
self.object_id = existing_rule["id"]
if "uuid" in existing_rule and existing_rule["uuid"] is not None:
self.find_by_parameter = "uuid"
else:
self.find_by_parameter = "id"
self.object_id = existing_rule[self.find_by_parameter]
return self.object_id
return False

def delete(self):
return super(ServiceApplyRule, self).delete(find_by="id")
return super(ServiceApplyRule, self).delete(find_by=self.find_by_parameter)

def modify(self):
return super(ServiceApplyRule, self).modify(find_by="id")
return super(ServiceApplyRule, self).modify(find_by=self.find_by_parameter)

def diff(self):
return super(ServiceApplyRule, self).diff(find_by="id")
return super(ServiceApplyRule, self).diff(find_by=self.find_by_parameter)


# ===========================================
Expand Down
Loading