Skip to content

Commit d56563d

Browse files
committed
refactor: use module.run_command instead of subprocess
Ansible modules should use module.run_command instead of subprocess. This is flagged by the latest ansible-test Signed-off-by: Rich Megginson <rmeggins@redhat.com>
1 parent 2044cbf commit d56563d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

library/network_connections.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
import re
6868
import shlex
6969
import socket
70-
import subprocess
7170
import time
7271
import traceback
7372
import logging
@@ -2684,7 +2683,8 @@ def forget_nm_connection(self, path):
26842683
present and did not save any state about the corresponding interface.
26852684
"""
26862685
try:
2687-
subprocess.call(
2686+
# run_command returns rc, stdout, and stderr but we don't need them
2687+
_rc, _stdout, _stderr = self.run_env.run_command(
26882688
[
26892689
"busctl",
26902690
"--system",
@@ -2696,7 +2696,8 @@ def forget_nm_connection(self, path):
26962696
"as",
26972697
"1",
26982698
path,
2699-
]
2699+
],
2700+
handle_exceptions=False,
27002701
)
27012702
except Exception:
27022703
pass

0 commit comments

Comments
 (0)