@@ -61,11 +61,18 @@ def get_resource(client, resource_name, resource_id=None, resource_module_params
6161
6262 if resource_name .endswith ("_binding" ):
6363 # binding resources require `filter` instead of `args` to uniquely identify a resource
64- status_code , response_body = client .get (
65- resource = resource_name ,
66- id = resource_id ,
67- filter = get_args ,
68- )
64+ if resource_name .startswith ("systemglobal_" ):
65+ status_code , response_body = client .get (
66+ resource = "systemglobal" ,
67+ id = resource_id ,
68+ filter = get_args ,
69+ )
70+ else :
71+ status_code , response_body = client .get (
72+ resource = resource_name ,
73+ id = resource_id ,
74+ filter = get_args ,
75+ )
6976 elif resource_name in {"sslcertfile" }:
7077 status_code , response_body = client .get (
7178 resource = resource_name ,
@@ -92,7 +99,7 @@ def get_resource(client, resource_name, resource_id=None, resource_module_params
9299 return False , []
93100 if status_code in HTTP_SUCCESS_CODES :
94101 # for zero bindings and some resources, the response_body will be {'errorcode': 0, 'message': 'Done', 'severity': 'NONE'}
95- if resource_name not in response_body :
102+ if resource_name not in response_body and not resource_name . startswith ( "systemglobal_" ) :
96103 if resource_name == "sslcipher" :
97104 resource_primary_key = NITRO_RESOURCE_MAP [resource_name ]["primary_key" ]
98105 return True , [
@@ -101,7 +108,10 @@ def get_resource(client, resource_name, resource_id=None, resource_module_params
101108
102109 return False , []
103110 # `update-only` resources return a dict instead of a list.
104- return_response = response_body [resource_name ]
111+ if resource_name .startswith ("systemglobal_" ):
112+ return_response = response_body ["systemglobal" ]
113+ else :
114+ return_response = response_body [resource_name ]
105115 # FIXME: NITRO-BUG: for some resources like `policypatset_pattern_binding`, NITRO returns keys with uppercase. eg: `String` for `string`.
106116 # So, we are converting the keys to lowercase.
107117 # except for `ping` and `traceroute`, all the othe resources returns a keys with lowercase.
0 commit comments