mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #7737 from toddmowen/zfs-fix-7696
zfs: fix incompatibility - share.nfs vs sharenfs (issue #7696)
This commit is contained in:
commit
c548d0fb3b
1 changed files with 13 additions and 8 deletions
|
@ -310,14 +310,19 @@ class Zfs(object):
|
|||
self.set_property(prop, value)
|
||||
|
||||
def get_current_properties(self):
|
||||
def get_properties_by_name(propname):
|
||||
cmd = [self.module.get_bin_path('zfs', True)]
|
||||
cmd.append('get -H all')
|
||||
cmd.append(self.name)
|
||||
rc, out, err = self.module.run_command(' '.join(cmd))
|
||||
properties = dict()
|
||||
for l in out.splitlines():
|
||||
p, v = l.split('\t')[1:3]
|
||||
properties[p] = v
|
||||
cmd += ['get', '-H', propname, self.name]
|
||||
rc, out, err = self.module.run_command(cmd)
|
||||
return [l.split('\t')[1:3] for l in out.splitlines()]
|
||||
properties = dict(get_properties_by_name('all'))
|
||||
if 'share.*' in properties:
|
||||
# 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
|
||||
|
||||
def run_command(self, cmd):
|
||||
|
|
Loading…
Reference in a new issue