aboutsummaryrefslogtreecommitdiff
path: root/kolla_ansible
diff options
context:
space:
mode:
authorMichal Nasiadka <mnasiadka@gmail.com>2024-11-20 16:48:04 +0100
committerMichal Nasiadka <mnasiadka@gmail.com>2024-11-20 16:01:14 +0000
commit4f62dd4661ebe83a891cc69e51e88831e408bdca (patch)
tree8f3ae017533c1cac4d33719612ccae2ef46d7510 /kolla_ansible
parent5a9e2684534d240b8835801110859399d6aea471 (diff)
downloadkolla-ansible-4f62dd4661ebe83a891cc69e51e88831e408bdca.tar.gz
kolla-ansible-4f62dd4661ebe83a891cc69e51e88831e408bdca.zip
cli: Add check=True to catch Ansible failures
From [1]: If check is true, and the process exits with a non-zero exit code, a CalledProcessError exception will be raised. Attributes of that exception hold the arguments, the exit code, and stdout and stderr if they were captured. [1]: https://docs.python.org/3/library/subprocess.html Closes-Bug: #2089173 Change-Id: I8cf38c2f7db1493e7303e94c212251fbeafaced3
Diffstat (limited to 'kolla_ansible')
-rw-r--r--kolla_ansible/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/kolla_ansible/utils.py b/kolla_ansible/utils.py
index 3f1649048..316ba68dd 100644
--- a/kolla_ansible/utils.py
+++ b/kolla_ansible/utils.py
@@ -173,6 +173,6 @@ def run_command(executable: str,
if quiet:
kwargs["stdout"] = subprocess.DEVNULL
kwargs["stderr"] = subprocess.DEVNULL
- subprocess.run(full_cmd, shell=False, **kwargs) # nosec
+ subprocess.run(full_cmd, check=True, shell=False, **kwargs) # nosec
else:
- subprocess.run(full_cmd, shell=False, **kwargs) # nosec
+ subprocess.run(full_cmd, check=True, shell=False, **kwargs) # nosec