0

My code throws error when it reaches this line:

{% set encrypted_password = salt['cmd.run']('openssl enc -aes-128-cbc -a -salt -md md5 -in <(echo -n "' + ssm_plaintext_password +'") -pass pass:'+random_password) %}

Error:

[ERROR   ] Command '[u'openssl', u'enc', u'-aes-128-cbc', u'-a', u'-salt', u'-md', u'md5', u'-in', u'<(echo', u'-n', u'g0vknM6a%,)', u'-pass', u'pass:zHwhIwKesJVXZO9taCHuEVGSPTW3J95g']' failed with return code: 1
[ERROR   ] stdout: unknown option '-n'

But when I run the command openssl enc -aes-128-cbc -a -salt -md md5 -in <(echo -n "g0vknM6a%,") -pass pass:zHwhIwKesJVXZO9taCHuEVGSPTW3J95g it gives me the input.

I am executing this in Amazon Linux2 based instance having Python3 and salt-call 2019.2.0 (Fluorine) . Is this due to any binary version changes as this code worked perfectly with Amazon Linux1

Reshma
  • 1

2 Answers2

0

Add the python_shell=True option to cmd.run.

Utah_Dave
  • 532
  • 2
  • 6
  • 2
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - [From Review](/review/low-quality-posts/448076) – kenlukas May 13 '20 at 18:34
0

I got the solution here : https://github.com/saltstack/salt/issues/44226.

I replaced cmd.run with cmd.shell and this works fine for me.

Reshma
  • 1