Fix encrypt command output when using --stdin-name (#65122)

* Fix encrypt command output when using --stdin-name

Add a new line after reading input if input doesn't end with a new line

* Only print is we're in a tty

* Add changelog fragment
This commit is contained in:
Alexandre Chouinard 2019-12-05 15:42:15 -05:00 committed by ansibot
parent a0f26b40cb
commit edc7c4ddee
2 changed files with 5 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ansible-vault - Fix ``encrypt_string`` output in a tty when using ``--sdtin-name`` option (https://github.com/ansible/ansible/issues/65121)

View file

@ -318,6 +318,9 @@ class VaultCLI(CLI):
if stdin_text == '':
raise AnsibleOptionsError('stdin was empty, not encrypting')
if sys.stdout.isatty() and not stdin_text.endswith("\n"):
display.display("\n")
b_plaintext = to_bytes(stdin_text)
# defaults to None