INNER CODE UNIT · Python
reset
ansible-collections/community.vmware · plugins/connection/vmware_tools.py:379
def reset(self):
"""Reset the connection to vcenter."""
# TODO: Fix persistent connection implementation currently ansible creates new connections to vcenter for each task
# therefore we're currently closing a non existing connection here and establish a connection just for being thrown away
# right afterwards.
self.close()
self._connect(check_vm_credentials=False)
def create_temporary_file_in_guest(self, prefix="", suffix=""):
"""Create a temporary file in the VM."""
try:
return self.fileManager.CreateTemporaryFileInGuest(vm=self.vm, auth=self.vm_auth, prefix=prefix, suffix=suffix)
except vim.fault.NoPermission as e:
raise AnsibleError("No Permission Error: %s %s" % (to_native(e.msg), to_native(e.privilegeId)))
except vmodl.fault.SystemError as e:
if e.reason == 'vix error codes = (3016, 0).\n':
raise AnsibleConnectionFailure(
"Connection failed, is the vm currently rebooting? Reason: %s" % (