File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 135135 'cacheglobal_cachepolicy_binding' ,
136136 'botglobal_botpolicy_binding' ,
137137]
138+
139+ GETALL_ONLY_RESOURCES = [
140+ 'appfwlearningdata' ,
141+ 'application' ,
142+ 'bridgetable' ,
143+ 'gslbldnsentry' ,
144+ 'locationfile' ,
145+ 'locationfile6' ,
146+ 'routerdynamicrouting' ,
147+ 'sslcertbundle' ,
148+ 'sslcertfile' ,
149+ 'sslcrlfile' ,
150+ 'ssldhfile' ,
151+ 'sslkeyfile' ,
152+ 'systementitydata'
153+ ]
Original file line number Diff line number Diff line change 3838 HTTP_RESOURCE_ALREADY_EXISTS ,
3939 NETSCALER_COMMON_ARGUMENTS ,
4040 NITRO_ATTRIBUTES_ALIASES ,
41+ GETALL_ONLY_RESOURCES ,
4142)
4243from .decorators import trace
4344from .logger import log , loglines
@@ -320,7 +321,7 @@ def get_existing_resource(self):
320321 )
321322 if is_exist is False :
322323 return {}
323- if len (existing_resource ) > 1 :
324+ if self . resource_name not in GETALL_ONLY_RESOURCES and len (existing_resource ) > 1 :
324325 msg = (
325326 "ERROR: For resource `%s` Found more than one resource with the same primary key `%s` and resource_module_params %s"
326327 % (
@@ -330,8 +331,20 @@ def get_existing_resource(self):
330331 )
331332 )
332333 self .return_failure (msg )
333-
334- self .existing_resource = existing_resource [0 ]
334+ self .existing_resource = existing_resource [0 ]
335+ else :
336+ for resources in existing_resource :
337+ # Check if all module params match this resource
338+ match_found = True
339+ for key , value in self .resource_module_params .items ():
340+ if key in resources and resources [key ] != value :
341+ match_found = False
342+ break
343+
344+ # If all parameters match, use this resource
345+ if match_found :
346+ self .existing_resource = resources
347+ break
335348
336349 if self .resource_name in NITRO_ATTRIBUTES_ALIASES :
337350 self .existing_resource = self ._add_nitro_attributes_aliases (
You can’t perform that action at this time.
0 commit comments