mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Adding a check in case the cache file is empty.
This commit is contained in:
parent
594c324beb
commit
b2475b1c35
@ -1303,12 +1303,20 @@ def write_mount_cache(real_name,
|
||||
'''
|
||||
cache = salt.utils.mount.read_cache(__opts__)
|
||||
|
||||
if 'mounts' in cache:
|
||||
cache['mounts'][real_name] = {'device': device,
|
||||
'fstype': fstype,
|
||||
'mkmnt': mkmnt,
|
||||
'opts': opts}
|
||||
if cache:
|
||||
if 'mounts' in cache:
|
||||
cache['mounts'][real_name] = {'device': device,
|
||||
'fstype': fstype,
|
||||
'mkmnt': mkmnt,
|
||||
'opts': opts}
|
||||
else:
|
||||
cache['mounts'] = {}
|
||||
cache['mounts'][real_name] = {'device': device,
|
||||
'fstype': fstype,
|
||||
'mkmnt': mkmnt,
|
||||
'opts': opts}
|
||||
else:
|
||||
cache = {}
|
||||
cache['mounts'] = {}
|
||||
cache['mounts'][real_name] = {'device': device,
|
||||
'fstype': fstype,
|
||||
@ -1333,8 +1341,9 @@ def delete_mount_cache(real_name):
|
||||
'''
|
||||
cache = salt.utils.mount.read_cache(__opts__)
|
||||
|
||||
if 'mounts' in cache:
|
||||
if real_name in cache['mounts']:
|
||||
del cache['mounts'][real_name]
|
||||
cache = salt.utils.mount.write_cache(cache, __opts__)
|
||||
if cache:
|
||||
if 'mounts' in cache:
|
||||
if real_name in cache['mounts']:
|
||||
del cache['mounts'][real_name]
|
||||
cache = salt.utils.mount.write_cache(cache, __opts__)
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user