1- #!/usr/bin/python
2- # -*- coding: utf-8 -*-
3-
41# Copyright (c) 2024 Cisco Systems, Inc. and its affiliates
52#
63# 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):
5754
5855 # Get task arguments
5956 module_args = self ._task .args .copy ()
60-
57+
6158 # Get the network OS from task variables or module arguments
6259 network_os = task_vars .get ('ansible_network_os' )
6360 display .vvvv (f"Using OS module: { network_os } " )
64-
61+
6562 # Determine which module to use based on network_os
6663 rest_module = get_rest_module (network_os )
6764 if not rest_module :
@@ -79,7 +76,7 @@ def run(self, tmp=None, task_vars=None):
7976 # Set the connection to httpapi
8077 if 'connection' not in task_vars :
8178 task_vars ['connection' ] = 'httpapi'
82-
79+
8380 # Execute the appropriate REST module
8481 result = self ._execute_module (
8582 module_name = rest_module ,
@@ -88,7 +85,7 @@ def run(self, tmp=None, task_vars=None):
8885 tmp = tmp ,
8986 wrap_async = False
9087 )
91-
88+
9289 # Update results with the module's results
9390 if result .get ('failed' ):
9491 results .update (result )
@@ -97,7 +94,7 @@ def run(self, tmp=None, task_vars=None):
9794 results ['changed' ] = result .get ('changed' , False )
9895 results .update (result )
9996 display .vvvv (f"Module execution successful: { result } " )
100-
97+
10198 except Exception as e :
10299 import traceback
103100 error_trace = traceback .format_exc ()
0 commit comments