From d56563dc16cb66ed803ab10cd21755c1a5ac996c Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 2 Apr 2026 09:04:13 -0600 Subject: [PATCH] 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 --- library/network_connections.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/network_connections.py b/library/network_connections.py index d53d169..95cc6b0 100644 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -67,7 +67,6 @@ import os import re import shlex import socket -import subprocess import time import traceback import logging @@ -2684,7 +2683,8 @@ class Cmd_initscripts(Cmd): present and did not save any state about the corresponding interface. """ try: - subprocess.call( + # run_command returns rc, stdout, and stderr but we don't need them + _rc, _stdout, _stderr = self.run_env.run_command( [ "busctl", "--system", @@ -2696,7 +2696,8 @@ class Cmd_initscripts(Cmd): "as", "1", path, - ] + ], + handle_exceptions=False, ) except Exception: pass