Пример #1
0
 def __editService(self,
                   service,
                   name=None,
                   description=None,
                   protocol=None,
                   ports=None,
                   status=None,
                   version=None,
                   owned=None):
     res = False
     if service is not None:
         service.updateAttributes(name, description, protocol, ports,
                                  status, version, owned)
         notifier.editHost(service.getHost())
         res = True
     return res
Пример #2
0
 def addUpdate(self, old_object, new_object, command_id):
     # Returns True if the update was resolved without user interaction
     try:
         mergeAction = old_object.addUpdate(new_object, command_id)
         if mergeAction:
             if old_object not in self.objects_with_updates:
                 self.objects_with_updates.append(old_object)
             notifier.conflictUpdate(1)
             return False
     except Exception as ex:
         api.devlog("(%s).addUpdate(%s, %s) - failed" %
                    (self, old_object, new_object))
         return False
     self.mappers_manager.update(old_object, command_id)
     notifier.editHost(old_object)
     return True
Пример #3
0
    def __del(self, objId, *args):
        obj = self.mappers_manager.find(objId)
        if obj:
            obj_parent = obj.getParent()
            if obj_parent:
                obj_parent.deleteChild(objId)

            self.removeConflictsByObject(obj)

            self.mappers_manager.remove(objId, obj.class_signature)

            if obj.class_signature == models.Host.class_signature:
                notifier.delHost(objId)
            else:
                notifier.editHost(obj.getHost())
            return True
        return False
Пример #4
0
 def __edit(self, obj, command_id=None, *args, **kwargs):
     obj.updateAttributes(*args, **kwargs)
     self.mappers_manager.update(obj, command_id)
     notifier.editHost(obj)
     return True