mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Test length of comps when listing mounts
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.
This commit is contained in:
parent
ad8456eeed
commit
6d0bce2418
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue