Merge pull request #35559 from Jlin317/fix_highstate_outputter

Fix highstate outputter when it's given multiple results
This commit is contained in:
Mike Place 2016-08-20 10:56:25 +09:00 committed by GitHub
commit bec8322e13

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