@@ -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,12 @@ 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 .get ("systemglobal" , None )
113+ if return_response is None :
114+ return False , []
115+ else :
116+ return_response = response_body [resource_name ]
105117 # FIXME: NITRO-BUG: for some resources like `policypatset_pattern_binding`, NITRO returns keys with uppercase. eg: `String` for `string`.
106118 # So, we are converting the keys to lowercase.
107119 # except for `ping` and `traceroute`, all the othe resources returns a keys with lowercase.
@@ -121,15 +133,19 @@ def get_resource(client, resource_name, resource_id=None, resource_module_params
121133 )
122134
123135 # Take care of NITRO Anomolies
124- return_response = fix_nitro_anomolies (
125- resource_name , resource_module_params , return_response
126- )
127- return (True , return_response )
136+ if return_response is not None :
137+ return_response = fix_nitro_anomolies (
138+ resource_name , resource_module_params , return_response
139+ )
140+ return (True , return_response if return_response is not None else [])
128141 return False , []
129142
130143
131144@trace
132145def fix_nitro_anomolies (resource_name , resource_module_params , return_response ):
146+ if return_response is None :
147+ return []
148+
133149 for resource in return_response :
134150 # FIXME: NITRO-BUG: in lbmonitor, for `interval=60`, the `units3` will wrongly be set to `MIN` by the NetScaler.
135151 # Hence, we will set it to `SEC` to make it idempotent
0 commit comments