From 299be52d6fc2179f19d1101a5f40d2ae171bb16a Mon Sep 17 00:00:00 2001 From: Gianmarco Mameli Date: Fri, 12 Jan 2024 12:04:41 +0100 Subject: [PATCH 01/12] working version --- plugins/modules/icinga_service_apply.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/modules/icinga_service_apply.py b/plugins/modules/icinga_service_apply.py index e5b5cba2..bfc43a46 100644 --- a/plugins/modules/icinga_service_apply.py +++ b/plugins/modules/icinga_service_apply.py @@ -260,18 +260,18 @@ 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"] + self.object_id = existing_rule["uuid"] return self.object_id return False def delete(self): - return super(ServiceApplyRule, self).delete(find_by="id") + return super(ServiceApplyRule, self).delete(find_by="uuid") def modify(self): - return super(ServiceApplyRule, self).modify(find_by="id") + return super(ServiceApplyRule, self).modify(find_by="uuid") def diff(self): - return super(ServiceApplyRule, self).diff(find_by="id") + return super(ServiceApplyRule, self).diff(find_by="uuid") # =========================================== From 7a28f791a9d8b0c8950fe176a773360fa69d9c88 Mon Sep 17 00:00:00 2001 From: Gianmarco Mameli Date: Mon, 15 Jan 2024 10:05:04 +0100 Subject: [PATCH 02/12] test for old director version with id --- plugins/modules/icinga_service_apply.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/modules/icinga_service_apply.py b/plugins/modules/icinga_service_apply.py index bfc43a46..85954aca 100644 --- a/plugins/modules/icinga_service_apply.py +++ b/plugins/modules/icinga_service_apply.py @@ -256,22 +256,28 @@ def __init__(self, module, data): super(ServiceApplyRule, self).__init__(module, path, data) def exists(self): + global find_by_value ret = self.call_url(path="/serviceapplyrules") if ret["code"] == 200: for existing_rule in ret["data"]["objects"]: if existing_rule["object_name"] == self.data["object_name"]: + if existing_rule["uuid"] != None: self.object_id = existing_rule["uuid"] - return self.object_id + find_by_value = "uuid" + else: + self.object_id = existing_rule["id"] + find_by_value = "id" + return self.object_id return False def delete(self): - return super(ServiceApplyRule, self).delete(find_by="uuid") + return super(ServiceApplyRule, self).delete(find_by=find_by_value) def modify(self): - return super(ServiceApplyRule, self).modify(find_by="uuid") + return super(ServiceApplyRule, self).modify(find_by=find_by_value) def diff(self): - return super(ServiceApplyRule, self).diff(find_by="uuid") + return super(ServiceApplyRule, self).diff(find_by=find_by_value) # =========================================== From ae4e0d2066a1a2e2fc372499c0dab0b15b54e301 Mon Sep 17 00:00:00 2001 From: Gianmarco Mameli Date: Mon, 15 Jan 2024 17:13:16 +0100 Subject: [PATCH 03/12] lint and bugfix --- plugins/modules/icinga_service_apply.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/plugins/modules/icinga_service_apply.py b/plugins/modules/icinga_service_apply.py index 85954aca..996366cf 100644 --- a/plugins/modules/icinga_service_apply.py +++ b/plugins/modules/icinga_service_apply.py @@ -251,33 +251,34 @@ # Icinga2 API class # class ServiceApplyRule(Icinga2APIObject): + find_by_parameter = None def __init__(self, module, data): path = "/service" super(ServiceApplyRule, self).__init__(module, path, data) def exists(self): - global find_by_value + # global FINDBY ret = self.call_url(path="/serviceapplyrules") if ret["code"] == 200: for existing_rule in ret["data"]["objects"]: if existing_rule["object_name"] == self.data["object_name"]: - if existing_rule["uuid"] != None: - self.object_id = existing_rule["uuid"] - find_by_value = "uuid" - else: - self.object_id = existing_rule["id"] - find_by_value = "id" - return self.object_id + if existing_rule["uuid"] is not None: + self.find_by_parameter = "uuid" + else: + # self.object_id = existing_rule["id"] + 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=find_by_value) + return super(ServiceApplyRule, self).delete(find_by=self.find_by_parameter) def modify(self): - return super(ServiceApplyRule, self).modify(find_by=find_by_value) + return super(ServiceApplyRule, self).modify(find_by=self.find_by_parameter) def diff(self): - return super(ServiceApplyRule, self).diff(find_by=find_by_value) + return super(ServiceApplyRule, self).diff(find_by=self.find_by_parameter) # =========================================== From b6b6033e17fe5074bd7cc95b46122c79531c9469 Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Tue, 16 Jan 2024 16:52:50 +0100 Subject: [PATCH 04/12] Update icinga_service_apply.py --- plugins/modules/icinga_service_apply.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/icinga_service_apply.py b/plugins/modules/icinga_service_apply.py index 996366cf..dbe5588b 100644 --- a/plugins/modules/icinga_service_apply.py +++ b/plugins/modules/icinga_service_apply.py @@ -262,7 +262,7 @@ def exists(self): if ret["code"] == 200: for existing_rule in ret["data"]["objects"]: if existing_rule["object_name"] == self.data["object_name"]: - if existing_rule["uuid"] is not None: + if "uuid" in existing_rule and existing_rule["uuid"] is not None: self.find_by_parameter = "uuid" else: # self.object_id = existing_rule["id"] From dbf2434d0ca5c3c60a8c3f2beaaa1e2c4cbbcaad Mon Sep 17 00:00:00 2001 From: Gianmarco Mameli Date: Tue, 16 Jan 2024 17:15:03 +0100 Subject: [PATCH 05/12] fix lint and cleanup --- plugins/modules/icinga_service_apply.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/modules/icinga_service_apply.py b/plugins/modules/icinga_service_apply.py index dbe5588b..7ee8a7a5 100644 --- a/plugins/modules/icinga_service_apply.py +++ b/plugins/modules/icinga_service_apply.py @@ -252,12 +252,12 @@ # class ServiceApplyRule(Icinga2APIObject): find_by_parameter = None + def __init__(self, module, data): path = "/service" super(ServiceApplyRule, self).__init__(module, path, data) def exists(self): - # global FINDBY ret = self.call_url(path="/serviceapplyrules") if ret["code"] == 200: for existing_rule in ret["data"]["objects"]: @@ -265,7 +265,6 @@ def exists(self): if "uuid" in existing_rule and existing_rule["uuid"] is not None: self.find_by_parameter = "uuid" else: - # self.object_id = existing_rule["id"] self.find_by_parameter = "id" self.object_id = existing_rule[self.find_by_parameter] return self.object_id From 4c7dfd798fc4e1147f76803892927d7d55a93aef Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Thu, 18 Jan 2024 13:30:18 +0100 Subject: [PATCH 06/12] try to test different director versions with the services function --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4f62fa69..e2a04cb9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,6 +29,9 @@ jobs: name: Sanity (Ⓐ${{ matrix.ansible }}) strategy: matrix: + icinga_director: + - 1.8.1 + - 1.11.0 ansible: # It's important that Sanity is tested against all stable-X.Y branches # Testing against `devel` may fail as new tests are added. @@ -161,7 +164,7 @@ jobs: python: '3.11' 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: From 864d36fd4f77b941877cdcd5cdc0b9c1e9bbc6cd Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Thu, 18 Jan 2024 13:33:09 +0100 Subject: [PATCH 07/12] try to test different director versions with the services function --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e2a04cb9..5992f61f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,9 +29,6 @@ jobs: name: Sanity (Ⓐ${{ matrix.ansible }}) strategy: matrix: - icinga_director: - - 1.8.1 - - 1.11.0 ansible: # It's important that Sanity is tested against all stable-X.Y branches # Testing against `devel` may fail as new tests are added. @@ -89,10 +86,13 @@ 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 From de99a60683c594fbaa396b82170d84db3aa608aa Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Thu, 18 Jan 2024 13:42:06 +0100 Subject: [PATCH 08/12] try to test different director versions with the services function --- .github/workflows/main.yml | 126 ++++++++++++++++++++++++++++++++----- 1 file changed, 110 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5992f61f..436df797 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -97,71 +97,165 @@ jobs: - 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-${{ matrix.icinga_director }} From c03937b36a6a2967bd3bdd8200e81ab9e819cdf3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 13:31:30 +0000 Subject: [PATCH 09/12] Update github/codeql-action digest to e5f05b8 --- .github/workflows/codeql-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index af5e885c..791eca63 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -45,7 +45,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3 + uses: github/codeql-action/init@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -56,7 +56,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3 + uses: github/codeql-action/autobuild@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -70,4 +70,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3 + uses: github/codeql-action/analyze@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3 From 78f287694359db4b94e529e667e80f3417ebc998 Mon Sep 17 00:00:00 2001 From: Sebastian Gumprich Date: Wed, 10 Jan 2024 08:42:54 +0100 Subject: [PATCH 10/12] use antsichaut action (#238) * use antsichaut action * Update release.yml * rever tto old, better name --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9f98a865..d5797da6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,7 +67,7 @@ jobs: python-version: 3.8 - name: Install antsibull-changelog, antsichaut - run: python -m pip install antsibull-changelog antsichaut --disable-pip-version-check + run: python -m pip install antsibull-changelog --disable-pip-version-check - name: Install pandoc run: sudo apt-get install pandoc @@ -88,9 +88,9 @@ jobs: run: antsibull-changelog release -v --version "${{ steps.version.outputs.next-version }}" - name: Generate changelog.yaml - run: antsichaut - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: ansible-community/antsichaut@0.4.0 + with: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" SINCE_VERSION: "${{ steps.previoustag.outputs.tag }}" - name: Update Changelog.rst From 2b7d9e4f07d90e48b449ed061537bba70c32a0ff Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 10 Jan 2024 07:43:11 +0000 Subject: [PATCH 11/12] Pin ansible-community/antsichaut action to 66464bb --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d5797da6..190738e8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,7 +88,7 @@ jobs: run: antsibull-changelog release -v --version "${{ steps.version.outputs.next-version }}" - name: Generate changelog.yaml - uses: ansible-community/antsichaut@0.4.0 + uses: ansible-community/antsichaut@66464bba7f07c56db4bfec4b14e70b71c0b43ca9 # 0.4.0 with: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" SINCE_VERSION: "${{ steps.previoustag.outputs.tag }}" From a8f8e238f896a654f38f4815f010be6f0ce7ee2e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 17 Jan 2024 18:44:40 +0000 Subject: [PATCH 12/12] Update github/codeql-action digest to 0b21cf2 --- .github/workflows/codeql-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 791eca63..e612e8a5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -45,7 +45,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3 + uses: github/codeql-action/init@0b21cf2492b6b02c465a3e5d7c473717ad7721ba # v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -56,7 +56,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3 + uses: github/codeql-action/autobuild@0b21cf2492b6b02c465a3e5d7c473717ad7721ba # v3 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -70,4 +70,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3 + uses: github/codeql-action/analyze@0b21cf2492b6b02c465a3e5d7c473717ad7721ba # v3