mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Clean up grain lookups from #10202
This commit is contained in:
parent
e937a85fe2
commit
9e968dd297
@ -122,7 +122,6 @@ def destroy(device):
|
||||
except CommandExecutionError:
|
||||
return False
|
||||
|
||||
os = __salt__['grains.items']()['os']
|
||||
stop_cmd = 'mdadm --stop {0}'.format(device)
|
||||
zero_cmd = 'mdadm --zero-superblock {0}'
|
||||
|
||||
@ -131,7 +130,7 @@ def destroy(device):
|
||||
__salt__['cmd.retcode'](zero_cmd.format(number['device']))
|
||||
|
||||
# Remove entry from config file:
|
||||
if os == 'Ubuntu' or os == 'Debian':
|
||||
if __grains__.get('os_family') == 'Debian':
|
||||
cfg_file = '/etc/mdadm/mdadm.conf'
|
||||
else:
|
||||
cfg_file = '/etc/mdadm.conf'
|
||||
@ -226,7 +225,7 @@ def create(*args):
|
||||
|
||||
|
||||
def save_config():
|
||||
"""
|
||||
'''
|
||||
Save RAID configuration to config file.
|
||||
|
||||
Same as:
|
||||
@ -241,12 +240,11 @@ def save_config():
|
||||
|
||||
salt '*' raid.save_config
|
||||
|
||||
"""
|
||||
os = __salt__['grains.items']()['os']
|
||||
'''
|
||||
scan = __salt__['cmd.run']('mdadm --detail --scan').split()
|
||||
# Issue with mdadm and ubuntu
|
||||
# REF: http://askubuntu.com/questions/209702/why-is-my-raid-dev-md1-showing-up-as-dev-md126-is-mdadm-conf-being-ignored
|
||||
if os == 'Ubuntu':
|
||||
if __grains__['os'] == 'Ubuntu':
|
||||
buggy_ubuntu_tags = ['name', 'metadata']
|
||||
for bad_tag in buggy_ubuntu_tags:
|
||||
for i, elem in enumerate(scan):
|
||||
@ -254,7 +252,7 @@ def save_config():
|
||||
del scan[i]
|
||||
|
||||
scan = ' '.join(scan)
|
||||
if os == 'Ubuntu' or os == 'Debian':
|
||||
if __grains__.get('os_family') == 'Debian':
|
||||
cfg_file = '/etc/mdadm/mdadm.conf'
|
||||
else:
|
||||
cfg_file = '/etc/mdadm.conf'
|
||||
|
Loading…
Reference in New Issue
Block a user