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

Only considers local attributes when comparing state

This should fix #1092
This commit is contained in:
Johan Wirén 2015-12-10 22:53:06 +01:00 committed by Matt Clay
parent 14a0cf142d
commit 7bb79093c2

View file

@ -176,9 +176,7 @@ class Zfs(object):
def set_properties_if_changed(self):
current_properties = self.get_current_properties()
for prop, value in self.properties.iteritems():
if prop not in current_properties:
self.module.fail_json(msg="invalid property '%s'" % prop)
if current_properties[prop] != value:
if current_properties.get(prop, None) != value:
self.set_property(prop, value)
def get_current_properties(self):
@ -188,8 +186,9 @@ class Zfs(object):
cmd += ['all', self.name]
rc, out, err = self.module.run_command(" ".join(cmd))
properties = dict()
for p, v in [l.split('\t')[1:3] for l in out.splitlines()]:
properties[p] = v
for prop, value, source in [l.split('\t')[1:4] for l in out.splitlines()]:
if source == 'local':
properties[prop] = value
# Add alias for enhanced sharing properties
properties['sharenfs'] = properties.get('share.nfs', None)
properties['sharesmb'] = properties.get('share.smb', None)