zfs: work around incompatibility by renaming share.nfs to sharenfs

Fixes #7696
This commit is contained in:
Todd Owen 2014-06-12 16:18:16 +08:00
parent 9d86d41741
commit 34517b0836

View file

@ -310,14 +310,19 @@ class Zfs(object):
self.set_property(prop, value) self.set_property(prop, value)
def get_current_properties(self): def get_current_properties(self):
cmd = [self.module.get_bin_path('zfs', True)] def get_properties_by_name(propname):
cmd.append('get -H all') cmd = [self.module.get_bin_path('zfs', True)]
cmd.append(self.name) cmd += ['get', '-H', propname, self.name]
rc, out, err = self.module.run_command(' '.join(cmd)) rc, out, err = self.module.run_command(cmd)
properties = dict() return [l.split('\t')[1:3] for l in out.splitlines()]
for l in out.splitlines(): properties = dict(get_properties_by_name('all'))
p, v = l.split('\t')[1:3] if 'share.*' in properties:
properties[p] = v # Some ZFS pools list the sharenfs and sharesmb properties
# hierarchically as share.nfs and share.smb respectively.
del properties['share.*']
for p, v in get_properties_by_name('share.all'):
alias = p.replace('.', '') # share.nfs -> sharenfs (etc)
properties[alias] = v
return properties return properties
def run_command(self, cmd): def run_command(self, cmd):