mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 06:31:23 -07:00
VMware: check for ESXi server while creating user (#33061)
This fix check for ESXi server instance before proceeding with managing local user. Also, adds integration tests for this change. Fixes: #32465 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
31510259f6
commit
29d3505cb4
10 changed files with 183 additions and 24 deletions
|
@ -808,6 +808,24 @@ class PyVmomi(object):
|
|||
self.current_vm_obj = None
|
||||
self.content = connect_to_api(self.module)
|
||||
|
||||
def is_vcenter(self):
|
||||
"""
|
||||
Check if given hostname is vCenter or ESXi host
|
||||
Returns: True if given connection is with vCenter server
|
||||
False if given connection is with ESXi server
|
||||
|
||||
"""
|
||||
api_type = None
|
||||
try:
|
||||
api_type = self.content.about.apiType
|
||||
except (vmodl.RuntimeFault, vim.fault.VimFault) as exc:
|
||||
self.module.fail_json(msg="Failed to get status of vCenter server : %s" % exc.msg)
|
||||
|
||||
if api_type == 'VirtualCenter':
|
||||
return True
|
||||
elif api_type == 'HostAgent':
|
||||
return False
|
||||
|
||||
# Virtual Machine related functions
|
||||
def get_vm(self):
|
||||
vm = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue