def enum_instances(self, env, model, keys_only): """Enumerate instances. The WBEM operations EnumerateInstances and EnumerateInstanceNames are both mapped to this method. This method is a python generator Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) model -- A template of the pywbem.CIMInstances to be generated. The properties of the model are already filtered according to the PropertyList from the request. Only properties present in the model need to be given values. If you prefer, you can always set all of the values, and the instance will be filtered for you. keys_only -- A boolean. True if only the key properties should be set on the generated instances. Possible Errors: CIM_ERR_FAILED (some other unspecified error occurred) """ logger = env.get_logger() logger.log_debug('Entering %s.enum_instances()' \ % self.__class__.__name__) if POLLUPDATE: poll_updater.updatePollFile(logger) # Prime model.path with knowledge of the keys, so key values on # the CIMInstanceName (model.path) will automatically be set when # we set property values on the model. model.path.update({'Dependent': None, 'Antecedent': None}) systemCreationClassName, systemName = self.getComputerSystemName(env) self._populateTroveCache() for troveId in sorted(self._conarySoftwareMap): # We need to specify the namespace, otherwise sfcb segfaults. model['Dependent'] = pywbem.CIMInstanceName( classname=systemCreationClassName, keybindings = dict(Name = systemName, CreationClassName = systemCreationClassName), namespace = "root/cimv2") model['Antecedent'] = pywbem.CIMInstanceName( classname='VAMI_SoftwareIdentity', keybindings = dict( InstanceID = troveId), namespace = "root/cimv2", ) if keys_only: yield model else: try: yield self.get_instance(env, model, withCleanup=False) except pywbem.CIMError, (num, msg): if num not in (pywbem.CIM_ERR_NOT_FOUND, pywbem.CIM_ERR_ACCESS_DENIED): raise
def enum_instances(self, env, model, keys_only): """Enumerate instances. The WBEM operations EnumerateInstances and EnumerateInstanceNames are both mapped to this method. This method is a python generator Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) model -- A template of the pywbem.CIMInstances to be generated. The properties of the model are already filtered according to the PropertyList from the request. Only properties present in the model need to be given values. If you prefer, you can always set all of the values, and the instance will be filtered for you. keys_only -- A boolean. True if only the key properties should be set on the generated instances. Possible Errors: CIM_ERR_FAILED (some other unspecified error occurred) """ logger = env.get_logger() logger.log_debug('Entering %s.enum_instances()' \ % self.__class__.__name__) if POLLUPDATE: poll_updater.updatePollFile(logger) # Prime model.path with knowledge of the keys, so key values on # the CIMInstanceName (model.path) will automatically be set when # we set property values on the model. model.path.update({'Dependent': None, 'Antecedent': None}) systemCreationClassName, systemName = self.getComputerSystemName(env) self._populateTroveCache() for troveId in sorted(self._conarySoftwareMap): # We need to specify the namespace, otherwise sfcb segfaults. model['Dependent'] = pywbem.CIMInstanceName( classname=systemCreationClassName, keybindings=dict(Name=systemName, CreationClassName=systemCreationClassName), namespace="root/cimv2") model['Antecedent'] = pywbem.CIMInstanceName( classname='VAMI_SoftwareIdentity', keybindings=dict(InstanceID=troveId), namespace="root/cimv2", ) if keys_only: yield model else: try: yield self.get_instance(env, model, withCleanup=False) except pywbem.CIMError, (num, msg): if num not in (pywbem.CIM_ERR_NOT_FOUND, pywbem.CIM_ERR_ACCESS_DENIED): raise
def cim_method_checkavailableupdates(self, env, object_name, param_target=None): """Implements RPATH_SoftwareInstallationService.CheckAvailableUpdates() Check for updates Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName specifying the object on which the method CheckAvailableUpdates() should be invoked. param_target -- The input parameter Target (type REF (pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...)) Reference to the ManagedElement that the Software Identity is going to be installed in (or updated). Returns a two-tuple containing the return value (type pywbem.Uint32 self.Values.CheckAvailableUpdates) and a list of CIMParameter objects representing the output parameters Output parameters: Job -- (type REF (pywbem.CIMInstanceName(classname='CIM_ConcreteJob', ...)) Reference to the job (may be null if job completed). Possible Errors: CIM_ERR_ACCESS_DENIED CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized or otherwise incorrect parameters) CIM_ERR_NOT_FOUND (the target CIM Class or instance does not exist in the specified namespace) CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor the invocation request) CIM_ERR_FAILED (some other unspecified error occurred) """ logger = env.get_logger() logger.log_debug('Entering %s.cim_method_checkavailableupdates()' \ % self.__class__.__name__) if POLLUPDATE: poll_updater.updatePollFile(logger) # Create update job concreteJob = concrete_job.UpdateJob().new() concreteJob.startUpdateCheck() # XXX Should be VAMI_UpdateConcreteJob job = pywbem.CIMInstanceName(classname='RPATH_UpdateConcreteJob', keybindings = dict( InstanceID = RPATH_UpdateConcreteJob.RPATH_UpdateConcreteJob.createInstanceID(concreteJob.get_job_id())), namespace = "root/cimv2") out_params = [] out_params.append(pywbem.CIMParameter('job', type='reference', value=job)) rval = self.Values.CheckAvailableUpdates.Method_Parameters_Checked___Job_Started return (rval, out_params)
def cim_method_installfromnetworklocations(self, env, object_name, param_managementnodeaddresses=None, param_sources=None, param_installoptions=None, param_target=None, param_installoptionvalues=None): """Implements RPATH_SoftwareInstallationService.InstallFromNetworkLocations() Start a job to update or migrate software on a ManagedElement (Target). Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName specifying the object on which the method InstallFromNetworkLocations() should be invoked. param_sources -- The input parameter Sources (type [unicode,]) References to the locations param_installoptions -- The input parameter InstallOptions (type [pywbem.Uint16,] self.Values.InstallFromNetworkLocations.InstallOptions) blah param_target -- The input parameter Target (type REF (pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...)) The installation target. param_installoptionvalues -- The input parameter InstallOptionValues (type [unicode,]) blah Returns a two-tuple containing the return value (type pywbem.Uint32 self.Values.InstallFromNetworkLocations) and a list of CIMParameter objects representing the output parameters Output parameters: Job -- (type REF (pywbem.CIMInstanceName(classname='CIM_ConcreteJob', ...)) Reference to the job (may be null if job completed). Possible Errors: CIM_ERR_ACCESS_DENIED CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized or otherwise incorrect parameters) CIM_ERR_NOT_FOUND (the target CIM Class or instance does not exist in the specified namespace) CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor the invocation request) CIM_ERR_FAILED (some other unspecified error occurred) """ logger = env.get_logger() logger.log_debug('Entering %s.cim_method_installfromnetworklocations()' \ % self.__class__.__name__) if POLLUPDATE: poll_updater.updatePollFile(logger) out_params = [] if param_managementnodeaddresses: try: import helper_rpath_tools registration = helper_rpath_tools.Registration() registration.setConaryProxy(param_managementnodeaddresses) except Exception: pass # Filter out empty params, only needed to bypass a problem in yawn # dropping the trailing ] param_sources = [ x for x in (param_sources or []) if x ] if not param_sources: # XXX if no sources specified, result should be an error of some # sort rval = self.Values.InstallFromNetworkLocations.Job_Completed_with_No_Error return (rval, out_params) # Extract flags optionsMap = { self.Values.InstallFromNetworkLocations.InstallOptions.Update : "-mupdate", self.Values.InstallFromNetworkLocations.InstallOptions.Migrate : "-mmigrate", self.Values.InstallFromNetworkLocations.InstallOptions.Update_All : "-mupdateall", self.Values.InstallFromNetworkLocations.InstallOptions.Test : "-t", } args = [optionsMap[x] for x in param_installoptions if x in optionsMap] execPath = os.path.join(os.path.dirname(concrete_job.__file__), 'concrete_job.py') args.insert(0, execPath) args.insert(0, pythonPath) for source in param_sources: args.append("-p%s" % source) # Use subprocess to start the update job. concrete_job double forks, # so the wait will return almost immediately. concreteJobProc = subprocess.Popen(args, stdout=subprocess.PIPE) concreteJobProc.wait() # job id is printed to standard out stdoutdata, stderrdata = concreteJobProc.communicate() concreteJobId = stdoutdata.strip('\n') # XXX Should be VAMI_UpdateConcreteJob job = pywbem.CIMInstanceName(classname='RPATH_UpdateConcreteJob', keybindings = dict( InstanceID = RPATH_UpdateConcreteJob.RPATH_UpdateConcreteJob.createInstanceID(concreteJobId)), namespace = "root/cimv2") out_params = [] out_params.append(pywbem.CIMParameter('job', type='reference', value=job)) rval = self.Values.CheckAvailableUpdates.Method_Parameters_Checked___Job_Started return (rval, out_params)
def cim_method_installfromsoftwareidentity(self, env, object_name, param_installoptions=None, param_target=None, param_collection=None, param_source=None, param_installoptionsvalues=None): """Implements RPATH_SoftwareInstallationService.InstallFromSoftwareIdentity() Start a job to install or update a SoftwareIdentity (Source) on a ManagedElement (Target). \nIn addition the method can be used to add the SoftwareIdentity simulataneously to a specified SofwareIndentityCollection. A client MAY specify either or both of the Collection and Target parameters. The Collection parameter is only supported if SoftwareInstallationService.CanAddToCollection is TRUE. \nIf 0 is returned, the function completed successfully and no ConcreteJob instance was required. If 4096/0x1000 is returned, a ConcreteJob will be started to perform the install. The Job\'s reference will be returned in the output parameter Job. Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName specifying the object on which the method InstallFromSoftwareIdentity() should be invoked. param_installoptions -- The input parameter InstallOptions (type [pywbem.Uint16,] self.Values.InstallFromSoftwareIdentity.InstallOptions) Options to control the install process.\nDefer target/system reset : do not automatically reset the target/system.\nForce installation : Force the installation of the same or an older SoftwareIdentity. Install: Perform an installation of this software on the managed element.\nUpdate: Perform an update of this software on the managed element.\nRepair: Perform a repair of the installation of this software on the managed element by forcing all the files required for installing the software to be reinstalled.\nReboot: Reboot or reset the system immediately after the install or update of this software, if the install or the update requires a reboot or reset.\nPassword: Password will be specified as clear text without any encryption for performing the install or update.\nUninstall: Uninstall the software on the managed element.\nLog: Create a log for the install or update of the software.\nSilentMode: Perform the install or update without displaying any user interface.\nAdministrativeMode: Perform the install or update of the software in the administrative mode. ScheduleInstallAt: Indicates the time at which theinstall or update of the software will occur. param_target -- The input parameter Target (type REF (pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...)) The installation target. If NULL then the SOftwareIdentity will be added to Collection only. The underlying implementation is expected to be able to obtain any necessary metadata from the Software Identity. param_collection -- The input parameter Collection (type REF (pywbem.CIMInstanceName(classname='CIM_Collection', ...)) Reference to the Collection to which the Software Identity SHALL be added. If NULL then the SOftware Identity will not be added to a Collection. param_source -- The input parameter Source (type REF (pywbem.CIMInstanceName(classname='CIM_SoftwareIdentity', ...)) Reference to the source of the install. param_installoptionsvalues -- The input parameter InstallOptionsValues (type [unicode,]) InstallOptionsValues is an array of strings providing additional information to InstallOptions for the method to install the software. Each entry of this array is related to the entry in InstallOptions that is located at the same index providing additional information for InstallOptions. \nIf the index in InstallOptions has the value "Password " then a value at the corresponding index of InstallOptionValues shall not be NULL. \nIf the index in InstallOptions has the value "ScheduleInstallAt" then the value at the corresponding index of InstallOptionValues shall not be NULL and shall be in the datetime type format. \nIf the index in InstallOptions has the value "Log " then a value at the corresponding index of InstallOptionValues may be NULL. \nIf the index in InstallOptions has the value "Defer target/system reset", "Force installation","Install", "Update", "Repair" or "Reboot" then a value at the corresponding index of InstallOptionValues shall be NULL. Returns a two-tuple containing the return value (type pywbem.Uint32 self.Values.InstallFromSoftwareIdentity) and a list of CIMParameter objects representing the output parameters Output parameters: Job -- (type REF (pywbem.CIMInstanceName(classname='CIM_ConcreteJob', ...)) Reference to the job (may be null if job completed). Possible Errors: CIM_ERR_ACCESS_DENIED CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized or otherwise incorrect parameters) CIM_ERR_NOT_FOUND (the target CIM Class or instance does not exist in the specified namespace) CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor the invocation request) CIM_ERR_FAILED (some other unspecified error occurred) """ logger = env.get_logger() logger.log_debug('Entering %s.cim_method_installfromsoftwareidentity()' \ % self.__class__.__name__) if POLLUPDATE: poll_updater.updatePollFile(logger) if param_source and param_source.has_key('InstanceID'): instanceId = param_source['InstanceID'] else: instanceId = None # Create update job concreteJob = concrete_job.UpdateJob().new() concreteJob.startApplyUpdate(instanceId) # XXX Should be VAMI_UpdateConcreteJob job = pywbem.CIMInstanceName(classname='RPATH_UpdateConcreteJob', keybindings = dict( InstanceID = RPATH_UpdateConcreteJob.RPATH_UpdateConcreteJob.createInstanceID(concreteJob.get_job_id())), namespace = "root/cimv2") out_params = [] out_params.append(pywbem.CIMParameter('job', type='reference', value=job)) rval = self.Values.CheckAvailableUpdates.Method_Parameters_Checked___Job_Started return (rval, out_params)
def get_instance(self, env, model, withCleanup=True): """Return an instance. Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) model -- A template of the pywbem.CIMInstance to be returned. The key properties are set on this instance to correspond to the instanceName that was requested. The properties of the model are already filtered according to the PropertyList from the request. Only properties present in the model need to be given values. If you prefer, you can set all of the values, and the instance will be filtered for you. Possible Errors: CIM_ERR_ACCESS_DENIED CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized or otherwise incorrect parameters) CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM Instance does not exist in the specified namespace) CIM_ERR_FAILED (some other unspecified error occurred) """ logger = env.get_logger() logger.log_debug('Entering %s.get_instance()' \ % self.__class__.__name__) if POLLUPDATE: poll_updater.updatePollFile(logger) if withCleanup: self._populateTroveCache() keyId = model['Antecedent'].keybindings['InstanceID'] # Fetch the trove from the software map (n, v, f), isInstalled = self._conarySoftwareMap[keyId] if isInstalled is self.installationService.SystemModelType: # From the mof: # "Supports"indicates that the software will work with or operate # the Managed Element but is or will be installed on a different # Managed Element. # The system model does exist on the Managed Element, so this may # not be correct, but it does make a distinction between the system # model and the top-level items, and it is correct on Windows model['ElementSoftwareStatus'] = [ self.Values.ElementSoftwareStatus.Supports, ] elif isInstalled: model['ElementSoftwareStatus'] = [ self.Values.ElementSoftwareStatus.Current, self.Values.ElementSoftwareStatus.Installed, ] else: model['ElementSoftwareStatus'] = [ self.Values.ElementSoftwareStatus.Available, ] model['UpgradeCondition'] = self.Values.UpgradeCondition.Owner_Upgradeable if withCleanup: self._conarySoftwareMap.clear() return model
def get_instance(self, env, model, withCleanup=True): """Return an instance. Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) model -- A template of the pywbem.CIMInstance to be returned. The key properties are set on this instance to correspond to the instanceName that was requested. The properties of the model are already filtered according to the PropertyList from the request. Only properties present in the model need to be given values. If you prefer, you can set all of the values, and the instance will be filtered for you. Possible Errors: CIM_ERR_ACCESS_DENIED CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized or otherwise incorrect parameters) CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM Instance does not exist in the specified namespace) CIM_ERR_FAILED (some other unspecified error occurred) """ logger = env.get_logger() logger.log_debug('Entering %s.get_instance()' \ % self.__class__.__name__) if POLLUPDATE: poll_updater.updatePollFile(logger) if withCleanup: self._populateTroveCache() keyId = model['Antecedent'].keybindings['InstanceID'] # Fetch the trove from the software map (n, v, f), isInstalled = self._conarySoftwareMap[keyId] if isInstalled is self.installationService.SystemModelType: # From the mof: # "Supports"indicates that the software will work with or operate # the Managed Element but is or will be installed on a different # Managed Element. # The system model does exist on the Managed Element, so this may # not be correct, but it does make a distinction between the system # model and the top-level items, and it is correct on Windows model['ElementSoftwareStatus'] = [ self.Values.ElementSoftwareStatus.Supports, ] elif isInstalled: model['ElementSoftwareStatus'] = [ self.Values.ElementSoftwareStatus.Current, self.Values.ElementSoftwareStatus.Installed, ] else: model['ElementSoftwareStatus'] = [ self.Values.ElementSoftwareStatus.Available, ] model[ 'UpgradeCondition'] = self.Values.UpgradeCondition.Owner_Upgradeable if withCleanup: self._conarySoftwareMap.clear() return model
def cim_method_checkavailableupdates(self, env, object_name, param_target=None): """Implements RPATH_SoftwareInstallationService.CheckAvailableUpdates() Check for updates Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName specifying the object on which the method CheckAvailableUpdates() should be invoked. param_target -- The input parameter Target (type REF (pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...)) Reference to the ManagedElement that the Software Identity is going to be installed in (or updated). Returns a two-tuple containing the return value (type pywbem.Uint32 self.Values.CheckAvailableUpdates) and a list of CIMParameter objects representing the output parameters Output parameters: Job -- (type REF (pywbem.CIMInstanceName(classname='CIM_ConcreteJob', ...)) Reference to the job (may be null if job completed). Possible Errors: CIM_ERR_ACCESS_DENIED CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized or otherwise incorrect parameters) CIM_ERR_NOT_FOUND (the target CIM Class or instance does not exist in the specified namespace) CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor the invocation request) CIM_ERR_FAILED (some other unspecified error occurred) """ logger = env.get_logger() logger.log_debug('Entering %s.cim_method_checkavailableupdates()' \ % self.__class__.__name__) if POLLUPDATE: poll_updater.updatePollFile(logger) # Create update job concreteJob = concrete_job.UpdateJob().new() concreteJob.startUpdateCheck() # XXX Should be VAMI_UpdateConcreteJob job = pywbem.CIMInstanceName( classname='RPATH_UpdateConcreteJob', keybindings=dict( InstanceID=RPATH_UpdateConcreteJob.RPATH_UpdateConcreteJob. createInstanceID(concreteJob.get_job_id())), namespace="root/cimv2") out_params = [] out_params.append( pywbem.CIMParameter('job', type='reference', value=job)) rval = self.Values.CheckAvailableUpdates.Method_Parameters_Checked___Job_Started return (rval, out_params)
def cim_method_installfromnetworklocations( self, env, object_name, param_managementnodeaddresses=None, param_sources=None, param_installoptions=None, param_target=None, param_installoptionvalues=None): """Implements RPATH_SoftwareInstallationService.InstallFromNetworkLocations() Start a job to update or migrate software on a ManagedElement (Target). Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName specifying the object on which the method InstallFromNetworkLocations() should be invoked. param_sources -- The input parameter Sources (type [unicode,]) References to the locations param_installoptions -- The input parameter InstallOptions (type [pywbem.Uint16,] self.Values.InstallFromNetworkLocations.InstallOptions) blah param_target -- The input parameter Target (type REF (pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...)) The installation target. param_installoptionvalues -- The input parameter InstallOptionValues (type [unicode,]) blah Returns a two-tuple containing the return value (type pywbem.Uint32 self.Values.InstallFromNetworkLocations) and a list of CIMParameter objects representing the output parameters Output parameters: Job -- (type REF (pywbem.CIMInstanceName(classname='CIM_ConcreteJob', ...)) Reference to the job (may be null if job completed). Possible Errors: CIM_ERR_ACCESS_DENIED CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized or otherwise incorrect parameters) CIM_ERR_NOT_FOUND (the target CIM Class or instance does not exist in the specified namespace) CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor the invocation request) CIM_ERR_FAILED (some other unspecified error occurred) """ logger = env.get_logger() logger.log_debug('Entering %s.cim_method_installfromnetworklocations()' \ % self.__class__.__name__) if POLLUPDATE: poll_updater.updatePollFile(logger) out_params = [] if param_managementnodeaddresses: try: import helper_rpath_tools registration = helper_rpath_tools.Registration() registration.setConaryProxy(param_managementnodeaddresses) except Exception: pass # Filter out empty params, only needed to bypass a problem in yawn # dropping the trailing ] param_sources = [x for x in (param_sources or []) if x] if not param_sources: # XXX if no sources specified, result should be an error of some # sort rval = self.Values.InstallFromNetworkLocations.Job_Completed_with_No_Error return (rval, out_params) # Extract flags optionsMap = { self.Values.InstallFromNetworkLocations.InstallOptions.Update: "-mupdate", self.Values.InstallFromNetworkLocations.InstallOptions.Migrate: "-mmigrate", self.Values.InstallFromNetworkLocations.InstallOptions.Update_All: "-mupdateall", self.Values.InstallFromNetworkLocations.InstallOptions.Test: "-t", } args = [optionsMap[x] for x in param_installoptions if x in optionsMap] execPath = os.path.join(os.path.dirname(concrete_job.__file__), 'concrete_job.py') args.insert(0, execPath) args.insert(0, pythonPath) for source in param_sources: args.append("-p%s" % source) # Use subprocess to start the update job. concrete_job double forks, # so the wait will return almost immediately. concreteJobProc = subprocess.Popen(args, stdout=subprocess.PIPE) concreteJobProc.wait() # job id is printed to standard out stdoutdata, stderrdata = concreteJobProc.communicate() concreteJobId = stdoutdata.strip('\n') # XXX Should be VAMI_UpdateConcreteJob job = pywbem.CIMInstanceName( classname='RPATH_UpdateConcreteJob', keybindings=dict( InstanceID=RPATH_UpdateConcreteJob.RPATH_UpdateConcreteJob. createInstanceID(concreteJobId)), namespace="root/cimv2") out_params = [] out_params.append( pywbem.CIMParameter('job', type='reference', value=job)) rval = self.Values.CheckAvailableUpdates.Method_Parameters_Checked___Job_Started return (rval, out_params)
def cim_method_installfromsoftwareidentity( self, env, object_name, param_installoptions=None, param_target=None, param_collection=None, param_source=None, param_installoptionsvalues=None): """Implements RPATH_SoftwareInstallationService.InstallFromSoftwareIdentity() Start a job to install or update a SoftwareIdentity (Source) on a ManagedElement (Target). \nIn addition the method can be used to add the SoftwareIdentity simulataneously to a specified SofwareIndentityCollection. A client MAY specify either or both of the Collection and Target parameters. The Collection parameter is only supported if SoftwareInstallationService.CanAddToCollection is TRUE. \nIf 0 is returned, the function completed successfully and no ConcreteJob instance was required. If 4096/0x1000 is returned, a ConcreteJob will be started to perform the install. The Job\'s reference will be returned in the output parameter Job. Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName specifying the object on which the method InstallFromSoftwareIdentity() should be invoked. param_installoptions -- The input parameter InstallOptions (type [pywbem.Uint16,] self.Values.InstallFromSoftwareIdentity.InstallOptions) Options to control the install process.\nDefer target/system reset : do not automatically reset the target/system.\nForce installation : Force the installation of the same or an older SoftwareIdentity. Install: Perform an installation of this software on the managed element.\nUpdate: Perform an update of this software on the managed element.\nRepair: Perform a repair of the installation of this software on the managed element by forcing all the files required for installing the software to be reinstalled.\nReboot: Reboot or reset the system immediately after the install or update of this software, if the install or the update requires a reboot or reset.\nPassword: Password will be specified as clear text without any encryption for performing the install or update.\nUninstall: Uninstall the software on the managed element.\nLog: Create a log for the install or update of the software.\nSilentMode: Perform the install or update without displaying any user interface.\nAdministrativeMode: Perform the install or update of the software in the administrative mode. ScheduleInstallAt: Indicates the time at which theinstall or update of the software will occur. param_target -- The input parameter Target (type REF (pywbem.CIMInstanceName(classname='CIM_ManagedElement', ...)) The installation target. If NULL then the SOftwareIdentity will be added to Collection only. The underlying implementation is expected to be able to obtain any necessary metadata from the Software Identity. param_collection -- The input parameter Collection (type REF (pywbem.CIMInstanceName(classname='CIM_Collection', ...)) Reference to the Collection to which the Software Identity SHALL be added. If NULL then the SOftware Identity will not be added to a Collection. param_source -- The input parameter Source (type REF (pywbem.CIMInstanceName(classname='CIM_SoftwareIdentity', ...)) Reference to the source of the install. param_installoptionsvalues -- The input parameter InstallOptionsValues (type [unicode,]) InstallOptionsValues is an array of strings providing additional information to InstallOptions for the method to install the software. Each entry of this array is related to the entry in InstallOptions that is located at the same index providing additional information for InstallOptions. \nIf the index in InstallOptions has the value "Password " then a value at the corresponding index of InstallOptionValues shall not be NULL. \nIf the index in InstallOptions has the value "ScheduleInstallAt" then the value at the corresponding index of InstallOptionValues shall not be NULL and shall be in the datetime type format. \nIf the index in InstallOptions has the value "Log " then a value at the corresponding index of InstallOptionValues may be NULL. \nIf the index in InstallOptions has the value "Defer target/system reset", "Force installation","Install", "Update", "Repair" or "Reboot" then a value at the corresponding index of InstallOptionValues shall be NULL. Returns a two-tuple containing the return value (type pywbem.Uint32 self.Values.InstallFromSoftwareIdentity) and a list of CIMParameter objects representing the output parameters Output parameters: Job -- (type REF (pywbem.CIMInstanceName(classname='CIM_ConcreteJob', ...)) Reference to the job (may be null if job completed). Possible Errors: CIM_ERR_ACCESS_DENIED CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized or otherwise incorrect parameters) CIM_ERR_NOT_FOUND (the target CIM Class or instance does not exist in the specified namespace) CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor the invocation request) CIM_ERR_FAILED (some other unspecified error occurred) """ logger = env.get_logger() logger.log_debug('Entering %s.cim_method_installfromsoftwareidentity()' \ % self.__class__.__name__) if POLLUPDATE: poll_updater.updatePollFile(logger) if param_source and param_source.has_key('InstanceID'): instanceId = param_source['InstanceID'] else: instanceId = None # Create update job concreteJob = concrete_job.UpdateJob().new() concreteJob.startApplyUpdate(instanceId) # XXX Should be VAMI_UpdateConcreteJob job = pywbem.CIMInstanceName( classname='RPATH_UpdateConcreteJob', keybindings=dict( InstanceID=RPATH_UpdateConcreteJob.RPATH_UpdateConcreteJob. createInstanceID(concreteJob.get_job_id())), namespace="root/cimv2") out_params = [] out_params.append( pywbem.CIMParameter('job', type='reference', value=job)) rval = self.Values.CheckAvailableUpdates.Method_Parameters_Checked___Job_Started return (rval, out_params)