Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SLS error output on conformity details per minion #372

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion api/utils/output/nested_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ def display(self, ret, indent, prefix, out):
)
elif isinstance(ret, str):
first_line = True
color = self.GREEN
if self.retcode != 0:
color = self.RED
for line in ret.splitlines():
line_prefix = " " * len(prefix) if not first_line else prefix
out.append(self.ustring(indent, self.GREEN, line, prefix=line_prefix))
out.append(self.ustring(indent, color, line, prefix=line_prefix))
first_line = False
elif isinstance(ret, (list, tuple)):
color = self.GREEN
Expand Down
2 changes: 1 addition & 1 deletion api/views/alcali.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def conformity_detail(self, request, minion_id):
last_highstate = last_highstate.loaded_ret()["return"]
# Sls error
if isinstance(last_highstate, list):
failed = {"error": last_highstate[0]}
failed = {'error': conv.convert(nested_output.output('\n'.join(last_highstate), _retcode = 1))}
else:
for state in last_highstate:
state_name = state.split("_|-")[1]
Expand Down