Skip to content

Commit 83e5439

Browse files
committed
Merge pull request #249 from QualiSystems/feature/borismod_152_advanced_refresh_ip
Refresh IP was fixed with the latest CloudShell API changes
2 parents 82b025f + 4f7bd63 commit 83e5439

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

vCenterShell/commands/refresh_ip.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)