catch GPG error
This commit is contained in:
@@ -11,7 +11,6 @@ import json
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import getpass
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
subparsers = parser.add_subparsers(title="commands", dest="command", required=True)
|
subparsers = parser.add_subparsers(title="commands", dest="command", required=True)
|
||||||
@@ -160,9 +159,12 @@ def decrypt_string(host, var) -> str:
|
|||||||
"ANSIBLE_LOAD_CALLBACK_PLUGINS": "1",
|
"ANSIBLE_LOAD_CALLBACK_PLUGINS": "1",
|
||||||
"ANSIBLE_STDOUT_CALLBACK": "json",
|
"ANSIBLE_STDOUT_CALLBACK": "json",
|
||||||
}
|
}
|
||||||
result = subprocess.run(
|
try:
|
||||||
ansible_command, env=ansible_env, capture_output=True, text=True, check=False
|
result = subprocess.run(
|
||||||
)
|
ansible_command, env=ansible_env, capture_output=True, text=True, check=True
|
||||||
|
)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
sys.exit(f"Decrypting the variable failed: {e.stderr}")
|
||||||
|
|
||||||
# Parse JSON
|
# Parse JSON
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user