diff options
| author | Michal Nasiadka <mnasiadka@gmail.com> | 2024-11-20 16:48:04 +0100 |
|---|---|---|
| committer | Michal Nasiadka <mnasiadka@gmail.com> | 2024-11-20 16:01:14 +0000 |
| commit | 4f62dd4661ebe83a891cc69e51e88831e408bdca (patch) | |
| tree | 8f3ae017533c1cac4d33719612ccae2ef46d7510 /kolla_ansible | |
| parent | 5a9e2684534d240b8835801110859399d6aea471 (diff) | |
| download | kolla-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.py | 4 |
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 |
