Skip to content

Commit

Permalink
Test length of comps when listing mounts
Browse files Browse the repository at this point in the history
If the stdout returned from the mount command ends with a newline char,
this produces an empty string during splitting.  This empty string is
attempted to be ``split()`` on whitespace, and thus produces an
empty-length list, which errors on the following line because no
elements are present.
  • Loading branch information
davidjb committed Jul 27, 2015
1 parent ad8456e commit 6d0bce2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion salt/modules/mount.py
Expand Up @@ -41,7 +41,8 @@ def _list_mounts():

for line in mounts.split('\n'):
comps = re.sub(r"\s+", " ", line).split()
ret[comps[2]] = comps[0]
if len(comps) >= 3:
ret[comps[2]] = comps[0]
return ret


Expand Down

0 comments on commit 6d0bce2

Please sign in to comment.