Fix disk.usage for Synology OS

relates to issue <a href="https://github.com/saltstack/salt/issues/20790">#20790</a>
This commit is contained in:
Jay McConnell 2015-02-19 02:08:54 +02:00 committed by Justin Findlay
parent aa96665a2b
commit ef75c5f45a

View File

@ -74,12 +74,20 @@ def usage(args=None):
cmd += ' -{0}'.format(flags)
ret = {}
out = __salt__['cmd.run'](cmd, python_shell=False).splitlines()
oldline=None
for line in out:
if not line:
continue
if line.startswith('Filesystem'):
continue
if oldline:
line = oldline + " " + line
comps = line.split()
if len(comps) == 1:
oldline=line
continue
else:
oldline=None
while not comps[1].isdigit():
comps[0] = '{0} {1}'.format(comps[0], comps[1])
comps.pop(1)