1
- #!/usr/bin/python
2
- # -*- coding: utf-8 -*-
3
-
4
1
# Copyright (c) 2024 Cisco Systems, Inc. and its affiliates
5
2
#
6
3
# Permission is hereby granted, free of charge, to any person obtaining a copy of
@@ -57,11 +54,11 @@ def run(self, tmp=None, task_vars=None):
57
54
58
55
# Get task arguments
59
56
module_args = self ._task .args .copy ()
60
-
57
+
61
58
# Get the network OS from task variables or module arguments
62
59
network_os = task_vars .get ('ansible_network_os' )
63
60
display .vvvv (f"Using OS module: { network_os } " )
64
-
61
+
65
62
# Determine which module to use based on network_os
66
63
rest_module = get_rest_module (network_os )
67
64
if not rest_module :
@@ -79,7 +76,7 @@ def run(self, tmp=None, task_vars=None):
79
76
# Set the connection to httpapi
80
77
if 'connection' not in task_vars :
81
78
task_vars ['connection' ] = 'httpapi'
82
-
79
+
83
80
# Execute the appropriate REST module
84
81
result = self ._execute_module (
85
82
module_name = rest_module ,
@@ -88,7 +85,7 @@ def run(self, tmp=None, task_vars=None):
88
85
tmp = tmp ,
89
86
wrap_async = False
90
87
)
91
-
88
+
92
89
# Update results with the module's results
93
90
if result .get ('failed' ):
94
91
results .update (result )
@@ -97,7 +94,7 @@ def run(self, tmp=None, task_vars=None):
97
94
results ['changed' ] = result .get ('changed' , False )
98
95
results .update (result )
99
96
display .vvvv (f"Module execution successful: { result } " )
100
-
97
+
101
98
except Exception as e :
102
99
import traceback
103
100
error_trace = traceback .format_exc ()
0 commit comments