mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
pass: Handle FileNotFoundError when pass binary is not available
This commit is contained in:
parent
c5caedc982
commit
98d1cdb972
1 changed files with 8 additions and 3 deletions
|
@ -144,12 +144,17 @@ def _fetch_secret(pass_path):
|
|||
if pass_gnupghome:
|
||||
env["GNUPGHOME"] = pass_gnupghome
|
||||
|
||||
proc = Popen(cmd, stdout=PIPE, stderr=PIPE, env=env)
|
||||
pass_data, pass_error = proc.communicate()
|
||||
try:
|
||||
proc = Popen(cmd, stdout=PIPE, stderr=PIPE, env=env)
|
||||
pass_data, pass_error = proc.communicate()
|
||||
pass_returncode = proc.returncode
|
||||
except OSError as e:
|
||||
pass_data, pass_error = "", str(e)
|
||||
pass_returncode = 1
|
||||
|
||||
# The version of pass used during development sent output to
|
||||
# stdout instead of stderr even though its returncode was non zero.
|
||||
if proc.returncode or not pass_data:
|
||||
if pass_returncode or not pass_data:
|
||||
try:
|
||||
pass_error = pass_error.decode("utf-8")
|
||||
except (AttributeError, ValueError):
|
||||
|
|
Loading…
Add table
Reference in a new issue