esxi_vlcm

Client for vCenter’s ESX Lifecycle Manager (vLCM) REST API.

Patches ESXi hosts in a vSphere cluster via the desired-image workflow: depots supply update payloads, a desired image draft is imported, validated and committed against a base image (plus optional add-ons), an apply policy controls remediation behavior (quick boot, DPM, HA), and the scan/check/stage/apply actions drive compliance checking and remediation against the cluster’s committed software spec. Endpoints live under:

/api/esx/settings/depots/...
/api/esx/settings/clusters/{cluster_id}/software/...
/api/esx/settings/clusters/{cluster_id}/policies/apply

All calls go through the vCenter session (saltext.vcf.utils.vcenter), so the standard saltext.vcf.vcenter pillar config is what selects the target vCenter — no separate connection config is needed for this domain. Mutating calls append vmw-task=true and return a vCenter CIS task id (a bare string, or {"value": "<id>"}); pass that response to wait_for_task() to block for completion.

saltext.vcf.clients.esxi_vlcm.online_depot_list(opts, profile=None)[source]

Return the list of configured online depots.

saltext.vcf.clients.esxi_vlcm.online_depot_create(opts, body, profile=None)[source]

Create an online depot. body carries at least a url.

saltext.vcf.clients.esxi_vlcm.online_depot_update(opts, depot_id, body, profile=None)[source]

Update an existing online depot.

saltext.vcf.clients.esxi_vlcm.offline_depot_list(opts, profile=None)[source]

Return the list of configured offline depots.

saltext.vcf.clients.esxi_vlcm.offline_depot_get(opts, depot_id, profile=None)[source]

Return a single offline depot.

saltext.vcf.clients.esxi_vlcm.offline_depot_create(opts, body, profile=None)[source]

Create an offline depot (task). body carries at least location.

saltext.vcf.clients.esxi_vlcm.offline_depot_delete(opts, depot_id, profile=None)[source]

Delete an offline depot (task).

saltext.vcf.clients.esxi_vlcm.depot_sync(opts, profile=None)[source]

Trigger a sync of all depots (task).

Some vCenter builds don’t expose this action and respond 404; that’s reported back as {"skipped": True} rather than raised, since there’s nothing to sync against on those builds.

saltext.vcf.clients.esxi_vlcm.desired_image_get(opts, cluster, profile=None)[source]

Return the cluster’s current desired image (committed software spec).

saltext.vcf.clients.esxi_vlcm.base_image_get(opts, cluster, profile=None)[source]

Return the cluster’s available base images.

saltext.vcf.clients.esxi_vlcm.drafts_list(opts, cluster, profile=None)[source]

Return the list of desired-image drafts on the cluster.

saltext.vcf.clients.esxi_vlcm.draft_get(opts, cluster, draft_id, profile=None)[source]

Return a single desired-image draft.

saltext.vcf.clients.esxi_vlcm.draft_delete(opts, cluster, draft_id, profile=None)[source]

Delete a desired-image draft.

saltext.vcf.clients.esxi_vlcm.draft_import_software_spec(opts, cluster, image_spec, profile=None)[source]

Import image_spec (a vLCM software spec dict) as a new draft.

Unlike the other draft/lifecycle actions, this one is not vmw-task-based — it always completes synchronously and returns the new draft directly, so no vmw-task=true is sent.

saltext.vcf.clients.esxi_vlcm.draft_validate(opts, cluster, draft_id, profile=None)[source]

Validate a desired-image draft (task).

saltext.vcf.clients.esxi_vlcm.draft_commit(opts, cluster, draft_id, message=None, profile=None)[source]

Commit a desired-image draft (task), making it the cluster’s desired image.

Always sends the message field, defaulting to "" — this vAPI action rejects a request with no Content-Type: application/json body at all (400 Bad Request), even though message is optional.

saltext.vcf.clients.esxi_vlcm.apply_policy_get(opts, cluster, profile=None)[source]

Return the cluster’s remediation apply policy.

saltext.vcf.clients.esxi_vlcm.apply_policy_set(opts, cluster, policy_spec, profile=None)[source]

Replace the cluster’s remediation apply policy.

saltext.vcf.clients.esxi_vlcm.compliance_scan(opts, cluster, commit='1', hosts=None, profile=None)[source]

Scan the cluster for compliance against its desired image (task).

commit selects which committed software spec to scan against ("1" is the current one — this vAPI action requires the field, it doesn’t default it server-side). hosts, if given, restricts the scan to those host ids; omitted means the whole cluster (sent as []).

saltext.vcf.clients.esxi_vlcm.precheck(opts, cluster, commit='1', profile=None)[source]

Run remediation prechecks on the cluster (task). See compliance_scan() on commit.

saltext.vcf.clients.esxi_vlcm.stage(opts, cluster, commit='1', hosts=None, profile=None)[source]

Stage the desired image on cluster hosts (task). See compliance_scan().

saltext.vcf.clients.esxi_vlcm.remediate(opts, cluster, accept_eula=True, profile=None)[source]

Remediate (apply the desired image to) the cluster (task).

Unlike scan/precheck/stage, this action’s body has no hosts field — remediation always targets the whole cluster.

saltext.vcf.clients.esxi_vlcm.last_check_result(opts, cluster, profile=None)[source]

Return the cluster’s last compliance/precheck result, or None if none exists yet.

saltext.vcf.clients.esxi_vlcm.apply_impact_report(opts, cluster, profile=None)[source]

Return the cluster’s apply-impact report, or None if none exists yet.

saltext.vcf.clients.esxi_vlcm.last_apply_result(opts, cluster, profile=None)[source]

Return the cluster’s last apply (remediate) result, or None if none exists yet.

saltext.vcf.clients.esxi_vlcm.wait_for_task(opts, resp, timeout=1800, poll_interval=10, profile=None)[source]

Block until the task referenced by resp (a vmw-task=true response) completes.

Returns the final task dict. Raises RuntimeError if the task fails, or TimeoutError if it doesn’t reach a terminal state within timeout. See saltext.vcf.utils.vcenter.wait_for_task().