File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,19 +48,9 @@ def _get_ip_match_function(session, resource_name):
4848 ip_regexes = []
4949 ip_regex = '.*'
5050
51- if resource .VmDetails \
52- and hasattr (resource .VmDetails [0 ], 'VmCustomParam' ) \
53- and resource .VmDetails [0 ].VmCustomParam \
54- and hasattr (resource .VmDetails [0 ].VmCustomParam , 'Name' ) \
55- and isinstance (resource .VmDetails [0 ].VmCustomParam .Name , str ) \
56- and resource .VmDetails [0 ].VmCustomParam .Name == 'ip_regex' \
57- and hasattr (resource .VmDetails [0 ].VmCustomParam , 'Value' ) \
58- and isinstance (resource .VmDetails [0 ].VmCustomParam .Value , str ):
59- ip_regexes = [resource .VmDetails [0 ].VmCustomParam .Value ]
60- elif resource .VmDetails \
61- and hasattr (resource .VmDetails [0 ], 'VmCustomParams' ) \
62- and resource .VmDetails [0 ].VmCustomParams :
63- custom_params = resource .VmDetails [0 ].VmCustomParams
51+ vm_details = resource .VmDetails
52+ if vm_details and hasattr (vm_details , 'VmCustomParams' ) and vm_details .VmCustomParams :
53+ custom_params = vm_details .VmCustomParams
6454 params = custom_params if isinstance (custom_params , list ) else [custom_params ]
6555 ip_regexes = [custom_param .Value for custom_param
6656 in params
You can’t perform that action at this time.
0 commit comments