From 9763e76f6f2606442ff033155f7d15f1cc0b9f8f Mon Sep 17 00:00:00 2001 From: Alexey Kalinin Date: Wed, 16 Mar 2016 11:24:20 -0700 Subject: [PATCH] add find_host_portgroup_by_name function to vmware utils --- lib/ansible/module_utils/vmware.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ansible/module_utils/vmware.py b/lib/ansible/module_utils/vmware.py index a0999c05442..9950cdd937c 100644 --- a/lib/ansible/module_utils/vmware.py +++ b/lib/ansible/module_utils/vmware.py @@ -108,6 +108,14 @@ def find_vm_by_name(content, vm_name): return None +def find_host_portgroup_by_name(host, portgroup_name): + + for portgroup in host.config.network.portgroup: + if portgroup.spec.name == portgroup_name: + return portgroup + return None + + def vmware_argument_spec(): return dict(