From 1f24a603a3c35823ce7104d71892705d3d9a065f Mon Sep 17 00:00:00 2001 From: ushiboy Date: Sun, 14 Dec 2025 13:45:50 +0900 Subject: [PATCH] Resolve status 10 error due to command order when active option is enabled --- nmcli/_connection.py | 7 ++++--- tests/test_connection.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nmcli/_connection.py b/nmcli/_connection.py index 49dfe90..e581bc7 100644 --- a/nmcli/_connection.py +++ b/nmcli/_connection.py @@ -89,11 +89,12 @@ def down(self, name: str, wait: int = None) -> None: self._syscmd.nmcli(cmd) def show(self, name: str, show_secrets: bool = False, active: bool = False) -> ConnectionDetails: - cmd = ['connection', 'show', name] - if show_secrets: - cmd += ["--show-secrets"] + cmd = ['connection', 'show'] if active: cmd += ["--active"] + cmd += [name] + if show_secrets: + cmd += ["--show-secrets"] r = self._syscmd.nmcli(cmd) results = {} for row in r.split('\n'): diff --git a/tests/test_connection.py b/tests/test_connection.py index 8cf488f..6b13bf5 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -129,7 +129,7 @@ def test_show(): connection.show(name, active=True) assert s.passed_parameters == [ - 'connection', 'show', name, "--active"] + 'connection', 'show', "--active", name] def test_reload():