Fix highstate outputter when it's given multiple results

This fixes issue #25664
This commit is contained in:
Jingran Lin 2016-08-18 10:27:48 +01:00
parent f2eb3dc105
commit 27aa038cc6

View file

@ -130,12 +130,15 @@ def output(data):
if 'data' in data:
data = data.pop('data')
for host, hostdata in six.iteritems(data):
if not isinstance(hostdata, dict):
# Highstate return data must be a dict, if this is not the case
# then this value is likely a retcode.
continue
return _format_host(host, hostdata)[0]
ret = [
_format_host(host, hostdata)[0]
for host, hostdata in six.iteritems(data)
# Highstate return data must be a dict, if this is not the case
# then this value is likely a retcode.
if isinstance(hostdata, dict)
]
if ret:
return "\n".join(ret)
log.error(
'Data passed to highstate outputter is not a valid highstate return: %s',
data