Skip to content

Commit d3048b9

Browse files
committed
fix error hamdling
1 parent 90f8670 commit d3048b9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plugins/modules/nmcli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2383,12 +2383,13 @@ def connection_exists(self):
23832383
def down_connection(self):
23842384
cmd = [self.nmcli_bin, "con", "down", self.conn_name]
23852385
return self.execute_command(cmd)
2386+
23862387
def get_connection_state(self):
23872388
"""Get the current state of the connection"""
23882389
cmd = [self.nmcli_bin, "--terse", "--fields", "GENERAL.STATE", "con", "show", self.conn_name]
23892390
(rc, out, err) = self.execute_command(cmd)
23902391
if rc != 0:
2391-
raise None
2392+
raise NmcliModuleError(err)
23922393

23932394
lines = out.strip().split('\n')
23942395
for line in lines:
@@ -2401,6 +2402,7 @@ def is_connection_active(self):
24012402
"""Check if the connection is currently active"""
24022403
state = self.get_connection_state()
24032404
return state == "activated"
2405+
24042406
def up_connection(self):
24052407
cmd = [self.nmcli_bin, "con", "up", self.conn_name]
24062408
return self.execute_command(cmd)

0 commit comments

Comments
 (0)