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