def get_instance(self, env, model, cim_class): # First verify that TheFoo actually refers to an entry in our # _FooInsts dictionary lpath = model['TheFoo'] if not 'FooKey' in lpath.keybindings: # TheFoo keyproperty missing the 'FooKey' property raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND, '') fk = lpath['FooKey'] if not fk in _FooInsts: # We don't have this entry in our dictionary raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND, '') # Now verity that TheFooComp actually refers to an entry in out # _FooComps dictionary lpath = model['TheFooComp'] if not 'FooCompKey' in lpath.keybindings: # TheFooComp keyproperty missing the 'FooCompKey' property raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND, '') fck = lpath['FooCompKey'] if not fck in _FooComps: # We don't have this entry in our dictionary raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND, '') # Verity that there truely is an association between these 2 objects if not _FooComps[fck] in _FooInsts: # The PyTut_FooComponent doesn't have a value that refers to the # PyTut_Foo object, so there is not association between them. raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND, '') # Everything checked out, so the given keys must refers to an actual # PyTut_FooAssociation object return model
def GetInstance(InstanceName, LocalOnly=True, IncludeQualifiers=False, IncludeClassOrigin=False, PropertyList=None, Connection=None): conn = Connection or _getdbconnection(InstanceName.namespace) try: theclass = GetClass(InstanceName.classname, InstanceName.namespace, LocalOnly, IncludeQualifiers=True, IncludeClassOrigin=True, Connection=conn) except pywbem.CIMError: Connection or conn.close(True) raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) try: # Convert instance name to string strkey = _make_key_string(InstanceName) cursor = conn.cursor() cursor.execute('select data from Instances where strkey=?', (strkey,)) try: data, = cursor.next() cursor.close(True) Connection or conn.close(True) ci = _decode(data) return _filter_instance(ci, theclass, IncludeQualifiers, IncludeClassOrigin, PropertyList) except StopIteration: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) except: Connection or conn.close(True) raise
def CreateClass(NewClass, namespace): conn = _getdbconnection(namespace) try: cursor = conn.cursor() # Make sure the class doesn't already exist cursor.execute('select cid from Classes where name=?', (NewClass.classname,)) try: cursor.next() cursor.close(True) conn.close(True) raise pywbem.CIMError(pywbem.CIM_ERR_ALREADY_EXISTS) except StopIteration: pass # Validate all quals in class _verify_qualifiers(conn, NewClass) # If there is a super class then synchronize the class # with the super class if NewClass.superclass: try: scid, scc = _get_class(conn, NewClass.superclass, namespace, LocalOnly=False, IncludeQualifiers=True, IncludeClassOrigin=True) except pywbem.CIMError, ce: if ce.args[0] == pywbem.CIM_ERR_NOT_FOUND: raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_SUPERCLASS, NewClass.superclass) raise NewClass = _adjust_child_class(NewClass, scc) else:
def DeleteInstance(InstanceName): conn = _getdbconnection(InstanceName.namespace) # Ensure the class exists try: oldcid, oldcc = _get_bare_class(conn, thename=ModifiedClass.classname) except TypeError: conn.close(True) raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_CLASS) try: # Convert instance name to string strkey = _make_key_string(InstanceName) cursor = conn.cursor() cursor.execute('select classname from Instances where strkey=?', (strkey,)) try: cursor.next() cursor.close(True) except StopIteration: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) cursor = conn.cursor() # TODO deal with associations cursor.execute( 'delete from Instances where strkey=?', (strkey,)) conn.close(True) except: conn.close(True) raise
def set_instance(self, env, instance, previous_instance, cim_class): if not previous_instance: # Create new instance if not 'FooKey' in instance \ or not instance['FooKey']: raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER, "'FooKey' property is required") if not 'FooValue' in instance: raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER, "'FooValue' property is required") if instance['FooKey'] in _FooInsts: raise pywbem.CIMError(pywbem.CIM_ERR_ALREADY_EXISTS) _FooInsts[instance['FooKey']] = instance['FooValue'] return instance # Modification if not 'FooKey' in previous_instance \ or not previous_instance['FooKey']: raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER, "Unknown instance for modification") if not previous_instance['FooKey'] in _FooInsts: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) if not 'FooValue' in instance: # Not modifying the only thing that can be modified, so there is # nothing to do. return instance # Modify the dictionary element _FooInsts[previous_instance['FooKey']] = instance['FooValue'] return instance
def set_instance(self, env, instance, previous_instance, cim_class): if not previous_instance: # Create new instance if not 'FooKey' in instance.properties: raise pywbem.CIMError(pywbem.CIM_INVALID_PARAMETER, "'FooKey' property is required") if not 'FooValue' in instance.properties: raise pywbem.CIMError(pywbem.CIM_INVALID_PARAMETER, "'FooValue' property is required") _FooInsts[instance['FooKey']] = instance['FooValue'] return instance # Modification if not 'FooValue' in instance.properties: # Not modifying the only thing that can be modified return instance if 'FooKey' in instance.properties: fv = instance['FooKey'] elif 'FooKey' in previous_instance.properties: fv = previous_instance['FooKey'] else: raise pywbem.CIMError(pywbem.CIM_INVALID_PARAMETER, "'FooValue' property not present") _FooInsts[fv] = instance['FooValue']
def set_instance(self, env, instance, previous_instance, cim_class): """Return a newly created or modified instance. Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) instance -- The new pywbem.CIMInstance. If modifying an existing instance, the properties on this instance have been filtered by the PropertyList from the request. previous_instance -- The previous pywbem.CIMInstance if modifying an existing instance. None if creating a new instance. cim_class -- The pywbem.CIMClass Return the new instance. The keys must be set on the new instance. Possible Errors: CIM_ERR_ACCESS_DENIED CIM_ERR_NOT_SUPPORTED CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized or otherwise incorrect parameters) CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only valid if previous_instance is None, indicating that the operation was CreateInstance) CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid if previous_instance is not None, indicating that the operation was ModifyInstance) CIM_ERR_FAILED (some other unspecified error occurred) """ logger = env.get_logger() logger.log_debug('Entering %s.set_instance()' \ % self.__class__.__name__) if previous_instance is not None: #Existing Instance or Modify if instance['Name'] not in self.storage: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) inst = self.storage[instance['Name']] inst.properties.update(instance.properties) #logger.log_debug("***** Updating stuff :%s *****" % instance.properties) #loop, if it exists, throw exception (Already_Exists) elif previous_instance is None: if instance['Name'] in self.storage: raise pywbem.CIMError(pywbem.CIM_ERR_ALREADY_EXISTS) else: #Creating a new instance #print "Copying Instance" #print "Instance name: %s"%str(instance['Name']) #for key in instance.properties.keys(): #print "key=%s"%str(key) self.storage[instance['Name']] = instance.copy() return instance
def cim_method_getintprop(self, env, object_name, method): logger = env.get_logger() logger.log_debug('Entering %s.cim_method_getintprop()' \ % self.__class__.__name__) if not hasattr(object_name, 'keybindings'): raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER) try: inst = g_insts[object_name['id']] except KeyError: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) out_params = {} rval = inst[1] return (rval, out_params)
def delete_instance(self, env, instance_name): """Delete an instance. Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) instance_name -- A pywbem.CIMInstanceName specifying the instance to delete. Possible Errors: CIM_ERR_ACCESS_DENIED CIM_ERR_NOT_SUPPORTED CIM_ERR_INVALID_NAMESPACE CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized or otherwise incorrect parameters) CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified namespace) 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.delete_instance()' \ % self.__class__.__name__) # TODO delete the resource raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
def get_instance(self, env, model, cim_class): """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. cim_class -- The pywbem.CIMClass 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__) try: model['TheValue'] = _PyFooInsts[model['TheKey']] except KeyError: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) return model
def ModifyInstance(ModifiedInstance, PropertyList=None): conn = _getdbconnection(ModifiedInstance.path.namespace) ipath = ModifiedInstance.path try: oldci = GetInstance(ipath, LocalOnly=False, IncludeQualifiers=True, IncludeClassOrigin=False, PropertyList=None, Connection=conn) if oldci.classname.lower() != ModifiedInstance.classname.lower(): raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER, 'Cannot change class of instance') if PropertyList: for propname in PropertyList: if propname not in ipath: # Only update if not key property if propname in ModifiedInstance.properties: oldci.properties[propname] = \ ModifiedInstance.properties[propname] elif propname in oldci.properties: del oldci.properties[propname] else: for propname,prop in ModifiedInstance.properties.iteritems(): # Only use non-key properties if propname not in ipath: oldci[propname] = prop strkey = _make_key_string(ipath) pci = _encode(oldci) cursor = conn.cursor() cursor.execute('update Instances set data=? where strkey=?', (pci, strkey)) conn.close(True) except: conn.close(True) raise
def get_instance(self, env, model, cim_class): try: if 'FooCompValue' in model: model['FooCompValue'] = _FooComps[model['FooCompKey']] except KeyError: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) return model
def EnumerateInstanceNames(ClassName, namespace): conn = _get_generator_connection(namespace) cursor = conn.cursor() try: try: # Make sure the class exists thecid,thecc = _get_bare_class(conn, thename=ClassName) except TypeError: raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_CLASS) classnames = [ClassName] for cname, in cursor.execute('select name from Classes where ' 'cid in (select subcid from SuperClasses where ' 'supercid=?);', (thecid,)): classnames.append(cname) for cname in classnames: for data, in cursor.execute('select data from Instances where ' 'classname=?', (cname,)): ci = _decode(data) yield ci.path conn.close() except: conn.close() raise
def DeleteClass(ClassName, namespace): conn = _getdbconnection(namespace) try: # Make sure the class exists try: thecid, thecc = _get_bare_class(conn, thename=ClassName) except TypeError: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) cursor = conn.cursor() # Get the names of all the classes that will be deleted. # Given class + children rmclasses = [x for x in cursor.execute('select name from Classes ' 'where cid in (select subcid from SuperClasses where ' 'supercid=?);', (thecid,))] rmclasses.append((ClassName,)) # Remove all instances of the classes that will be removed cursor.executemany('delete from Instances where classname=?;', rmclasses) # Delete all entries in the superclass table for class and children cursor.execute('delete from SuperClasses where supercid=? or ' 'subcid=?;', (thecid,thecid)) # Delete all entries from the Classes table cursor.executemany('delete from Classes where name=?;', rmclasses) conn.close(True) except: conn.close(True) raise
def set_instance(self, env, instance, modify_existing): """Return a newly created or modified instance. Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) instance -- The new pywbem.CIMInstance. If modifying an existing instance, the properties on this instance have been filtered by the PropertyList from the request. modify_existing -- True if ModifyInstance, False if CreateInstance Return the new instance. The keys must be set on the new instance. Possible Errors: CIM_ERR_ACCESS_DENIED CIM_ERR_NOT_SUPPORTED CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized or otherwise incorrect parameters) CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only valid if modify_existing is False, indicating that the operation was CreateInstance) CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid if modify_existing is True, indicating that the operation was ModifyInstance) CIM_ERR_FAILED (some other unspecified error occurred) """ logger = env.get_logger() logger.log_debug('Entering %s.set_instance()' \ % self.__class__.__name__) # TODO create or modify the instance raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement return instance
def set_instance(self, env, instance, previous_instance, cim_class): """ Return a newly created or modified instance. Keyword arguments: env -- Provider Environment instance -- The new CIMInstance. If modifying an existing instance, the properties on this instance have been filtered by the PropertyList from the request. previous_instance -- The previous instance if modifying an existing instance. None if creating a new instance. cim_class -- The CIMClass Return the new instance. The keys must be set on the new instance. Possible Errors: CIM_ERR_ACCESS_DENIED CIM_ERR_NOT_SUPPORTED CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized or otherwise incorrect parameters) CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only valid if previous_instance is None, indicating that the operation was CreateInstance) CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid if previous_instance is not None, indicating that the operation was ModifyInstance) CIM_ERR_FAILED (some other unspecified error occurred) """ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED, 'Modify the corresponding Py_LinuxFile instead')
def get_instance(self, env, model, cim_class): env.get_logger().log_debug('PyTut_FooAssociationProvider.getInstance ' 'called for class %s' % cim_class.classname) ch = env.get_cimom_handle() # Verify that the TheFooComp key actually refers to a # PyTut_FooComponent object. # This GetInstance call should raise a CIM_ERR_NOT_FOUND exception # if the PyTut_FooCompoent does not exist foocompinst = ch.GetInstance(model['TheFooComp'], LocalOnly=False, IncludeQualifiers=False, IncludeClassOrigin=False) # Verify that TheFoo key actually refers to a PyTut_Foo object # This GetInstance call should raise a CIM_ERR_NOT_FOUND exception # if the PyTut_Foo does not exist fooinst = ch.GetInstance(model['TheFoo'], LocalOnly=False, IncludeQualifiers=False, IncludeClassOrigin=False) # Verify that the PyTut_FooComponent.FooCompValue property has the same # value as the PyTut_Foo.FooKey property if foocompinst['FooCompValue'] != fooinst['FooKey']: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) # Everything checks out, so return the given model instance since it # already represents a completely filled out instance return model
def get_instance(self, env, model, cim_class): try: if 'FooValue' in model.properties: model['FooValue'] = _FooInsts[model['FooKey']] except KeyError: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND, '') return model
def delete_instance(self, env, instance_name): logger = env.get_logger() logger.log_debug('Entering %s.delete_instance()' \ % self.__class__.__name__) # TODO delete the resource raise pywbem.CIMError( pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
def set_instance(self, env, instance, previous_instance, cim_class): logger = env.get_logger() logger.log_debug('Entering %s.set_instance()' \ % self.__class__.__name__) # TODO create or modify the instance raise pywbem.CIMError( pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement return instance
def CreateInstance(NewInstance): ipath = NewInstance.path if not ipath or not ipath.keybindings: raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER, 'No key values for instance') class_name = NewInstance.classname; namespace = ipath.namespace conn = _getdbconnection(namespace) try: theclass = GetClass(NewInstance.classname, namespace, LocalOnly=False, IncludeQualifiers=True, IncludeClassOrigin=True, Connection=conn) except pywbem.CIMError: conn.close(True) raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_CLASS, 'Class %s does not exist in namespace %s' \ % (NewInstance.classname, namespace)) try: # Convert instance name to string strkey = _make_key_string(NewInstance.path) cursor = conn.cursor() cursor.execute('select classname from Instances where strkey=?', (strkey,)) try: cursor.next() cursor.close(True) conn.close(True) raise pywbem.CIMError(pywbem.CIM_ERR_ALREADY_EXISTS) except StopIteration: pass NewInstance.qualifiers = pywbem.NocaseDict() for prop in NewInstance.properties.itervalues(): prop.qualifiers = pywbem.NocaseDict() prop.class_origin = None pd = _encode(NewInstance) cursor.execute('insert into Instances values(?,?,?);', (class_name, strkey, pd)) conn.close(True) return ipath except: conn.close(True) raise
def delete_instance(self, env, instance_name): logger = env.get_logger() logger.log_debug('Entering %s.delete_instance()' \ % self.__class__.__name__) try: del g_insts[instance_name['id']] except KeyError: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
def get_instance(self, env, model, cim_class): logger = env.get_logger() logger.log_debug("### get_instance for PyTut_Foo") try: if 'FooValue' in model: model['FooValue'] = _FooInsts[model['FooKey']] except KeyError: raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) return model
def delete_instance(self, env, instance_name): """ Delete an instance of PyFooAssociation Keyword arguments: env -- Provider Environment instance_name -- A CIMInstanceName specifying the instance of PyFooAssociation to delete. """ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED, '')
def cim_method_mkunistr_char16(self, env, object_name, method, param_carr): logger = env.get_logger() logger.log_debug('Entering %s.cim_method_mkunistr_char16()' \ % self.__class__.__name__) # TODO do something raise pywbem.CIMError( pywbem.CIM_ERR_METHOD_NOT_AVAILABLE) # Remove to implemented out_params = {} rval = None # TODO (type unicode) return (rval, out_params)
def cim_method_mkunichararray(self, env, object_name, method, param_inarr): logger = env.get_logger() logger.log_debug('Entering %s.cim_method_mkunichararray()' \ % self.__class__.__name__) # TODO do something raise pywbem.CIMError( pywbem.CIM_ERR_METHOD_NOT_AVAILABLE) # Remove to implemented out_params = {} #out_params['outarr'] = # TODO (type [pywbem.Char16,]) rval = None # TODO (type bool) return (rval, out_params)
def references(self, env, object_name, model, assoc_class, result_class_name, role, result_role, keys_only): """Instrument PyFooAssociation Associations. All four association-related operations (Associators, AssociatorNames, References, ReferenceNames) are mapped to this method. This method is a python generator Keyword arguments: env -- Provider Environment object_name -- A CIMInstanceName that defines the source CIM Object whose associated Objects are to be returned. model -- A template CIMInstance of PyFooAssociation to serve as a model of the objects to be returned. Only properties present on this model need to be returned. assoc_class -- The CIMClass PyFooAssociation result_class_name -- If not None, acts as a filter on the returned set of Objects by mandating that each returned Object MUST be either an Instance of this Class (or one of its subclasses) or be this Class (or one of its subclasses). role -- If not None, acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the source Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the source Object MUST match the value of this parameter). result_role -- If not None, acts as a filter on the returned set of Objects by mandating that each returned Object MUST be associated to the source Object via an Association in which the returned Object plays the specified role (i.e. the name of the Property in the Association Class that refers to the returned Object MUST match the value of this parameter). """ if object_name.classname.lower() == 'pyfoo': model['ThePyFoo'] = object_name for k, v in _PyFooComps.items(): if v == object_name['FooKey']: model['TheComp'] = pywbem.CIMInstanceName( classname='PyFooComponent', namespace=object_name.namespace, keybindings={'TheKey': k}) yield model elif object_name.classname.lower() == 'pyfoocomponent': model['TheComp'] = object_name try: model['ThePyFoo'] = pywbem.CIMInstanceName( classname='PyFoo', namespace=object_name.namespace, keybindings={'FooKey': _PyFooComps[object_name['TheKey']]}) yield model except KeyError: pass else: raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, '')
def DeleteQualifier(QualifierName, namespace): conn = _getdbconnection(namespace) try: cursor = conn.cursor() if not GetQualifier(QualifierName, namespace, conn): raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND) cursor.execute( 'delete from QualifierTypes where name=?', (QualifierName,)) conn.close(True) except: conn.close(True) raise
def cim_method_setpowerstate(self, env, object_name, param_powerstate=None, param_time=None): """Implements RPATH_ComputerSystem.SetPowerState() Sets the power state of the computer. The use of this method has been deprecated. Instead, use the SetPowerState method in the associated PowerManagementService class. Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName specifying the object on which the method SetPowerState() should be invoked. param_powerstate -- The input parameter PowerState (type pywbem.Uint32 self.Values.SetPowerState.PowerState) The Desired state for the COmputerSystem. param_time -- The input parameter Time (type pywbem.CIMDateTime) Time indicates when the power state should be set, either as a regular date-time value or as an interval value (where the interval begins when the method invocation is received. Returns a two-tuple containing the return value (type pywbem.Uint32) and a list of CIMParameter objects representing the output parameters Output parameters: none 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_setpowerstate()' \ % self.__class__.__name__) # TODO do something raise pywbem.CIMError( pywbem.CIM_ERR_METHOD_NOT_AVAILABLE) # Remove to implemented out_params = [] #rval = # TODO (type pywbem.Uint32) return (rval, out_params)
def cim_method_stopservice(self, env, object_name): """Implements LMI_BasicExecutionServiceCondorManagement.StopService() The StopService method places the Service in the stopped state. Note that the function of this method overlaps with the RequestedState property. RequestedState was added to the model to maintain a record (such as a persisted value) of the last state request. Invoking the StopService method should set the RequestedState property appropriately. The method returns an integer value of 0 if the Service was successfully stopped, 1 if the request is not supported, and any other number to indicate an error. In a subclass, the set of possible return codes could be specified using a ValueMap qualifier on the method. The strings to which the ValueMap contents are translated can also be specified in the subclass as a Values array qualifier. \n\nNote: The semantics of this method overlap with the RequestStateChange method that is inherited from EnabledLogicalElement. This method is maintained because it has been widely implemented, and its simple "stop" semantics are convenient to use. Keyword arguments: env -- Provider Environment (pycimmb.ProviderEnvironment) object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName specifying the object on which the method StopService() should be invoked. Returns a two-tuple containing the return value (type pywbem.Uint32) and a list of CIMParameter objects representing the output parameters Output parameters: none 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_stopservice()' \ % self.__class__.__name__) # TODO do something raise pywbem.CIMError(pywbem.CIM_ERR_METHOD_NOT_AVAILABLE) # Remove to implemented out_params = [] #rval = # TODO (type pywbem.Uint32) return (rval, out_params)