From 98b025239a692b9b5d3533e977c0881792900348 Mon Sep 17 00:00:00 2001 From: Andreas Olsson Date: Wed, 16 Oct 2019 14:28:41 +0200 Subject: [PATCH] nsupdate: Don't try fixing non-existing TXT values (#63408) The commit 4e895c1 aimed to ensure that TXT record values were sanely quoted. Sadly it failed to take the scenario of non-existing values into account. While record values are required for record creation they are not required for record deletion. This change rectifies that oversight, saving Ansible from unsuccessfully trying to operate on NoneType objects. Resolves #63364 --- .../fragments/63408-nsupdate-dont-fix-none-txt-value.yaml | 2 ++ lib/ansible/modules/net_tools/nsupdate.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/63408-nsupdate-dont-fix-none-txt-value.yaml diff --git a/changelogs/fragments/63408-nsupdate-dont-fix-none-txt-value.yaml b/changelogs/fragments/63408-nsupdate-dont-fix-none-txt-value.yaml new file mode 100644 index 00000000000..860447580f7 --- /dev/null +++ b/changelogs/fragments/63408-nsupdate-dont-fix-none-txt-value.yaml @@ -0,0 +1,2 @@ +bugfixes: + - nsupdate - Do not try fixing non-existing TXT values (https://github.com/ansible/ansible/issues/63364) diff --git a/lib/ansible/modules/net_tools/nsupdate.py b/lib/ansible/modules/net_tools/nsupdate.py index 93350195225..59f29aa293b 100644 --- a/lib/ansible/modules/net_tools/nsupdate.py +++ b/lib/ansible/modules/net_tools/nsupdate.py @@ -232,7 +232,7 @@ class RecordManager(object): else: self.algorithm = module.params['key_algorithm'] - if self.module.params['type'].lower() == 'txt': + if self.module.params['type'].lower() == 'txt' and self.module.params['value'] is not None: self.value = list(map(self.txt_helper, self.module.params['value'])) else: self.value = self.module.params['value']