vim_vm_guest

In-guest operations via VMware Tools (SOAP GuestOperationsManager).

Two managers on ServiceContent.guestOperationsManager:

  • ProcessManager — start/list/terminate processes inside the guest

  • FileManager — upload, download, list, delete, mkdir, move files

All operations require VMware Tools running in the guest plus per-call NamePasswordAuthentication credentials. File transfer uses signed HTTPS URLs returned by the manager; the caller streams bytes there directly. See upload_file() for details.

saltext.vcf.clients.vim_vm_guest.run_command(opts, vm_id_or_name, program_path, arguments='', *, username, password, working_directory=None, env=None, profile=None)[source]

Start program_path inside the guest.

Returns the PID of the launched process. The call is fire-and-forget — use list_processes() to poll for completion / exit status.

saltext.vcf.clients.vim_vm_guest.list_processes(opts, vm_id_or_name, *, username, password, pids=None, profile=None)[source]

List guest processes. Returns a list of {pid, name, owner, cmd_line, start_time, exit_code, end_time} dicts.

When pids is provided, only those PIDs are reported (and entries with missing pids return None fields rather than a server-side error).

saltext.vcf.clients.vim_vm_guest.terminate_process(opts, vm_id_or_name, pid, *, username, password, profile=None)[source]

Send a guest-OS terminate signal to pid (kill -9 on Linux).

saltext.vcf.clients.vim_vm_guest.read_environment(opts, vm_id_or_name, *, username, password, names=None, profile=None)[source]

Return the guest user’s environment variables as a list of strings.

When names is provided, only those keys are returned; otherwise the full environment is fetched.

saltext.vcf.clients.vim_vm_guest.upload_file(opts, vm_id_or_name, src_path, dst_path, *, username, password, overwrite=True, permissions=420, verify_ssl=False, profile=None)[source]

Upload a local file to dst_path inside the guest.

The flow is:

  1. InitiateFileTransferToGuest returns a signed HTTPS URL

  2. HTTP PUT the file bytes to that URL

verify_ssl defaults to False because the URL points back to the ESXi host the VM is running on; in many lab configs that’s self-signed.

saltext.vcf.clients.vim_vm_guest.download_file(opts, vm_id_or_name, src_path, dst_path, *, username, password, verify_ssl=False, profile=None)[source]

Download src_path from the guest into a local dst_path.

saltext.vcf.clients.vim_vm_guest.list_files(opts, vm_id_or_name, path, *, username, password, pattern=None, profile=None)[source]

List directory entries at path in the guest.

saltext.vcf.clients.vim_vm_guest.make_directory(opts, vm_id_or_name, path, *, username, password, create_parents=False, profile=None)[source]

Create a directory inside the guest; create_parents mimics mkdir -p.