Skip to content

Commit

Permalink
Merge pull request #52150 from aplanas/fix_mdadm
Browse files Browse the repository at this point in the history
mdadm_raid: Optionally ignore errors on examine.
  • Loading branch information
dwoz authored Mar 12, 2019
2 parents caea45f + bfd8b11 commit d5d9e72
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions salt/modules/mdadm_raid.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,17 +360,25 @@ def assemble(name,
return __salt__['cmd.run'](cmd, python_shell=False)


def examine(device):
def examine(device, quiet=False):
'''
Show detail for a specified RAID component device
device
Device to examine, that is part of the RAID
quiet
If the device is not part of the RAID, do not show any error
CLI Example:
.. code-block:: bash
salt '*' raid.examine '/dev/sda1'
'''
res = __salt__['cmd.run_stdout']('mdadm -Y -E {0}'.format(device), output_loglevel='trace', python_shell=False)
res = __salt__['cmd.run_stdout']('mdadm -Y -E {0}'.format(device),
python_shell=False,
ignore_retcode=quiet)
ret = {}

for line in res.splitlines():
Expand Down
2 changes: 1 addition & 1 deletion salt/states/mdadm_raid.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def present(name,
if dev == 'missing' or not __salt__['file.access'](dev, 'f'):
missing.append(dev)
continue
superblock = __salt__['raid.examine'](dev)
superblock = __salt__['raid.examine'](dev, quiet=True)

if 'MD_UUID' in superblock:
uuid = superblock['MD_UUID']
Expand Down

0 comments on commit d5d9e72

Please sign in to comment.