This example shows how you can retrieve a list of available vCenter Server updates, details about the updates, and pre-check information. The example is based on the update_sample.py sample.
Note: For a complete and up-to-date version of the sample code, see the
vsphere-automation-sdk-python VMware repository at GitHub.
... # Create a stub configuration stub_config = StubConfigurationFactory.new_std_configuration(connector) self.pending_client = Pending(stub_config) self.precheck_client = PrecheckReport(stub_config) def run(self): # List updates available_updates = self.pending_client.list() print("vCenter Server available updates - ", available_updates) if available_updates.updates: target_version = available_updates.updates[0].version update_details = self.pending_client.get(target_version) print("vCenter Server available update details - ", update_details) # Get pre-check result precheck_result = self.precheck_client.create_task(target_version) print("Pre-upgrade checks task id started with: \n{0}".format(precheck_result.get_task_id())) ...