mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #3377 from techhat/nfs
NFS3 lets you specify multiple shares per line
This commit is contained in:
commit
a114e84cc7
@ -40,12 +40,18 @@ def list_exports(exports='/etc/exports'):
|
|||||||
continue
|
continue
|
||||||
comps = line.split()
|
comps = line.split()
|
||||||
ret[comps[0]] = []
|
ret[comps[0]] = []
|
||||||
|
newshares = []
|
||||||
for perm in comps[1:]:
|
for perm in comps[1:]:
|
||||||
|
if perm.startswith('/'):
|
||||||
|
newshares.append(perm)
|
||||||
|
continue
|
||||||
permcomps = perm.split('(')
|
permcomps = perm.split('(')
|
||||||
permcomps[1] = permcomps[1].replace(')', '')
|
permcomps[1] = permcomps[1].replace(')', '')
|
||||||
hosts = permcomps[0].split(',')
|
hosts = permcomps[0].split(',')
|
||||||
options = permcomps[1].split(',')
|
options = permcomps[1].split(',')
|
||||||
ret[comps[0]].append({'hosts': hosts, 'options': options})
|
ret[comps[0]].append({'hosts': hosts, 'options': options})
|
||||||
|
for share in newshares:
|
||||||
|
ret[share] = ret[comps[0]]
|
||||||
f.close()
|
f.close()
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@ -67,6 +73,15 @@ def del_export(exports='/etc/exports', path=None):
|
|||||||
def _write_exports(exports, edict):
|
def _write_exports(exports, edict):
|
||||||
'''
|
'''
|
||||||
Write an exports file to disk
|
Write an exports file to disk
|
||||||
|
|
||||||
|
If multiple shares were initially configured per line, like:
|
||||||
|
|
||||||
|
/media/storage /media/data *(ro,sync,no_subtree_check)
|
||||||
|
|
||||||
|
...then they will be saved to disk with only one share per line:
|
||||||
|
|
||||||
|
/media/storage *(ro,sync,no_subtree_check)
|
||||||
|
/media/data *(ro,sync,no_subtree_check)
|
||||||
'''
|
'''
|
||||||
f = open(exports, 'w')
|
f = open(exports, 'w')
|
||||||
for export in edict:
|
for export in edict:
|
||||||
|
Loading…
Reference in New Issue
Block a user