1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

zfs: avoid errors with creation-only properties (#1833) (#1958)

* avoid errors with creation-only properties

* add changelog fragment

* Apply suggestion to changelog fragment

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit ce5aea790d)

Co-authored-by: sam-lunt <samuel.j.lunt@gmail.com>
This commit is contained in:
patchback[bot] 2021-03-04 08:27:16 +01:00 committed by GitHub
parent 72a1f5bbd2
commit fcc531ee93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- zfs - some ZFS properties could be passed when the dataset/volume did not exist, but would fail if the dataset already existed, even if the property matched what was specified in the ansible task (https://github.com/ansible-collections/community.general/issues/868, https://github.com/ansible-collections/community.general/pull/1833).

View file

@ -203,7 +203,10 @@ class Zfs(object):
rc, out, err = self.module.run_command(" ".join(cmd))
properties = dict()
for prop, value, source in [l.split('\t')[1:4] for l in out.splitlines()]:
if source == 'local':
# include source '-' so that creation-only properties are not removed
# to avoids errors when the dataset already exists and the property is not changed
# this scenario is most likely when the same playbook is run more than once
if source == 'local' or source == '-':
properties[prop] = value
# Add alias for enhanced sharing properties
if self.enhanced_sharing: