Merge pull request #11515 from msabramo/nicer_output_for_parser_errors

Don't wrap text for AnsibleParserError
pull/11502/merge
Brian Coca 9 years ago
commit 898c7cc09f

@ -80,7 +80,7 @@ if __name__ == '__main__':
display.error(str(e))
sys.exit(5)
except AnsibleParserError as e:
display.error(str(e))
display.error(str(e), wrap_text=False)
sys.exit(4)
# TQM takes care of these, but leaving comment to reserve the exit codes
# except AnsibleHostUnreachable as e:

@ -182,10 +182,13 @@ class Display:
(out, err) = cmd.communicate()
self.display("%s\n" % out, color=color)
def error(self, msg):
new_msg = "\n[ERROR]: %s" % msg
wrapped = textwrap.wrap(new_msg, 79)
new_msg = "\n".join(wrapped) + "\n"
def error(self, msg, wrap_text=True):
if wrap_text:
new_msg = "\n[ERROR]: %s" % msg
wrapped = textwrap.wrap(new_msg, 79)
new_msg = "\n".join(wrapped) + "\n"
else:
new_msg = msg
if new_msg not in self._errors:
self.display(new_msg, color='red', stderr=True)
self._errors[new_msg] = 1

Loading…
Cancel
Save