Skip to content

Commit

Permalink
fix extraneous newlines after warnings without breaking ansible runner
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpetrello committed Mar 23, 2020
1 parent d3ec31f commit 8d290ad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/ansible/utils/display.py
Expand Up @@ -152,15 +152,15 @@ def display(self, msg, color=None, stderr=False, screen_only=False, log_only=Fal

nocolor = msg

if color:
msg = stringc(msg, color)

if not log_only:
if not msg.endswith(u'\n') and newline:
msg2 = msg + u'\n'
else:
msg2 = msg

if color:
msg2 = stringc(msg2, color)

msg2 = to_bytes(msg2, encoding=self._output_encoding(stderr=stderr))
if sys.version_info >= (3,):
# Convert back to text string on python3
Expand Down Expand Up @@ -266,7 +266,7 @@ def warning(self, msg, formatted=False):
if not formatted:
new_msg = "[WARNING]: %s" % msg
wrapped = textwrap.wrap(new_msg, self.columns)
new_msg = "\n".join(wrapped) + "\n"
new_msg = "\n".join(wrapped)
else:
new_msg = "\n[WARNING]: \n%s" % msg

Expand Down

0 comments on commit 8d290ad

Please sign in to comment.