From e27851e2e35a6bca2ee4f06546f6e34d51e1d214 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Tue, 20 Jun 2023 19:27:27 +0200 Subject: [PATCH] [PR #6748/806f6da1 backport][stable-7] icinga2_host: fix a key error when modifying an existing host (#6753) icinga2_host: fix a key error when modifying an existing host (#6748) * Initialize `template` variable. Add changelog fragment. * Update changelogs/fragments/6286-icinga2_host-template-and-template-vars.yml Co-authored-by: Felix Fontein * icinga2_host: fix a key error when updating a host * Changelog fragment. * Update changelog fragment with correct PR number. --------- Co-authored-by: Felix Fontein (cherry picked from commit 806f6da16bd35cf4600a518a79f4b759299968d5) Co-authored-by: yoannlr <32494673+yoannlr@users.noreply.github.com> --- changelogs/fragments/6748-icinga2_host-datafix.yml | 2 ++ plugins/modules/icinga2_host.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/6748-icinga2_host-datafix.yml diff --git a/changelogs/fragments/6748-icinga2_host-datafix.yml b/changelogs/fragments/6748-icinga2_host-datafix.yml new file mode 100644 index 0000000000..2aefd55096 --- /dev/null +++ b/changelogs/fragments/6748-icinga2_host-datafix.yml @@ -0,0 +1,2 @@ +bugfixes: + - "icinga2_host - fix a key error when updating an existing host (https://github.com/ansible-collections/community.general/pull/6748)." diff --git a/plugins/modules/icinga2_host.py b/plugins/modules/icinga2_host.py index ce9509cbc6..c7c325ad52 100644 --- a/plugins/modules/icinga2_host.py +++ b/plugins/modules/icinga2_host.py @@ -306,7 +306,7 @@ def main(): module.exit_json(changed=False, name=name, data=data) # Template attribute is not allowed in modification - del data['attrs']['templates'] + del data['templates'] ret = icinga.modify(name, data)