Skip to content

Commit 2af13fc

Browse files
committed
fix usage of wrong exception classes
Signed-off-by: Marc Crébassa <[email protected]>
1 parent 89205fb commit 2af13fc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plugins/module_utils/nc_tools.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def run_occ(
118118
elif isinstance(command, str):
119119
full_command = [cli_full_path, "--no-ansi"] + convert_string(command)
120120

121-
## execute the occ command in a child process to keep current privileges
121+
# execute the occ command in a child process to keep current privileges
122122
module_conn, occ_conn = Pipe()
123123
p = Process(
124124
target=execute_occ_command, args=(occ_conn, module, php_exec, full_command)
@@ -132,11 +132,11 @@ def run_occ(
132132
exception_type = result["exception"]
133133
# raise the proper exception.
134134
if exception_type == "OccFileNotFoundException":
135-
raise FileNotFoundError("The specified file was not found.")
135+
raise OccFileNotFoundException(full_command)
136136
elif exception_type == "OccAuthenticationException":
137-
raise PermissionError(result.get("msg", "Authentication failed."))
137+
raise OccAuthenticationException(full_command, **result)
138138
else:
139-
raise Exception(f"An unknown error occurred: {exception_type}")
139+
raise OccExceptions(f"An unknown error occurred: {exception_type}")
140140

141141
if "is in maintenance mode" in result["stderr"]:
142142
module.warn(" ".join(result["stderr"].splitlines()[0:1]))

0 commit comments

Comments
 (0)