예제 #1
0
 def exportConfiguration(self, triggerIds=None, notificationIds=None):
     facade = self._getFacade()
     triggers, notifications = facade.exportConfiguration(triggerIds, notificationIds)
     msg = "Exported %d triggers and %d notifications" % (len(triggers), len(notifications))
     audit("UI.TriggerNotification.Export", msg)
     return DirectResponse.succeed(
         triggers=Zuul.marshal(triggers), notifications=Zuul.marshal(notifications), msg=msg
     )
예제 #2
0
 def exportConfiguration(self, triggerIds=None, notificationIds=None):
     facade = self._getFacade()
     triggers, notifications = facade.exportConfiguration(triggerIds, notificationIds)
     msg = "Exported %d triggers and %d notifications" % (
              len(triggers), len(notifications)) 
     audit('UI.TriggerNotification.Export', msg)
     return DirectResponse.succeed(triggers=Zuul.marshal(triggers),
                                   notifications=Zuul.marshal(notifications),
                                   msg=msg)
예제 #3
0
    def test_recursion(self):
        data = [TestClass(), TestClass()]
        result = Zuul.marshal(data)
        self.assert_(isinstance(result, list))
        for o in result:
            self.match(o)

        data = {'a':TestClass(), 'b':TestClass()}
        result = Zuul.marshal(data)
        self.assert_(isinstance(result, dict))
        self.assertEqual(sorted(result.keys()), ['a', 'b'])
        for v in result.values():
            self.match(v)
예제 #4
0
    def test_recursion_with_keys(self):
        keys = ['foo', '_bar']
        data = [TestClass(), TestClass()]
        result = Zuul.marshal(data, keys=keys)
        self.assert_(isinstance(result, list))
        for o in result:
            self.match(o, keys=keys)

        data = {'a':TestClass(), 'b':TestClass()}
        result = Zuul.marshal(data, keys=keys)
        self.assert_(isinstance(result, dict))
        self.assertEqual(sorted(result.keys()), ['a', 'b'])
        for v in result.values():
            self.match(v, keys=keys)
예제 #5
0
파일: network.py 프로젝트: c0ns0le/zenoss-4
    def getIpAddresses(self, uid, start=0, params=None, limit=50, sort='ipAddressAsInt',
                       page=None, dir='ASC'):
        """
        Given a subnet, get a list of IP addresses and their relations.

        @type  uid: string
        @param uid: Unique identifier of a subnet
        @type  start: integer
        @param start: Offset to return the results from; used in pagination
        @type  params: string
        @param params: Not used
        @type  limit: integer
        @param limit: Number of items to return; used in pagination
        @type  sort: string
        @param sort: (optional) Key on which to sort the return results;
                     defaults to 'name'
        @type  order: string
        @param order: Sort order; can be either 'ASC' or 'DESC'
        @rtype: DirectResponse
        """
        if isinstance(params, basestring):
            params = unjson(params)
        instances = self.api.getIpAddresses(uid=uid, start=start, params=params,
                                          limit=limit, sort=sort, dir=dir)

        keys = ['name', 'netmask', 'pingstatus', 'snmpstatus', 'uid',
                'device', 'interface', 'macAddress',
                'interfaceDescription']
        data = Zuul.marshal(instances.results, keys)
        return DirectResponse.succeed(data=data, totalCount=instances.total,
                                      hash=instances.hash_)
예제 #6
0
 def getSequence(self, uid):
     """
     returns the sequence order of keys for a given instance
     """
     facade = self._getFacade()
     data = facade.getSequence(uid)
     return DirectResponse(data=Zuul.marshal(data))
예제 #7
0
 def getTraps(
         self, uid, dir='ASC', sort='name', start=0, page=None, limit=256):
     count, nodes = self.api.getMibNodes(
         uid=uid, dir=dir, sort=sort, start=start,
         limit=limit, relation='notifications'
     )
     return DirectResponse.succeed(count=count, data=Zuul.marshal(nodes))
예제 #8
0
 def _correctReportTitles(self, data):
     data = Zuul.marshal(data)
     # show the context in the report title, otherwise the user
     # has no idea which component the graph is for
     for row in data:
         row['title'] = row['contextTitle']
     return DirectResponse(data=data)
예제 #9
0
    def queryGenerator(self, sort='lastTime', dir='desc', evids=None, excludeIds=None, params=None,
                       archive=False, uid=None, detailFormat=False):
        """
        Query for events.

        @type  sort: string
        @param sort: (optional) Key on which to sort the return results (default:
                     'lastTime')
        @type  dir: string
        @param dir: (optional) Sort order; can be either 'ASC' or 'DESC'
                    (default: 'DESC')
        @type  params: dictionary
        @param params: (optional) Key-value pair of filters for this search.
                       (default: None)
        @type  archive: boolean
        @param archive: (optional) True to search the event archive instead
                        of active events (default: False)
        @type  uid: string
        @param uid: (optional) Context for the query (default: None)
        @rtype:   generator
        @return:  Generator returning events.
        """
        if not self._canViewEvents():
            return
        includeFilter, excludeFilter = self._buildRequestFilters(uid, params, evids, excludeIds)

        events = self.zep.getEventSummariesGenerator(filter=includeFilter, exclude=excludeFilter,
                                                      sort=self._buildSort(sort,dir), archive=archive)
        eventFormat = EventCompatInfo
        if detailFormat:
            eventFormat = EventCompatDetailInfo
        for event in events:
            yield Zuul.marshal(eventFormat(self.context.dmd, event))
예제 #10
0
 def getSequence(self, uid):
     """
     returns the sequence order of keys for a given instance
     """
     facade = self._getFacade()
     data = facade.getSequence(uid)        
     return DirectResponse(data=Zuul.marshal(data) )
예제 #11
0
 def getManufacturerData(self, uid):
     """
     return all extra data for manufacturer id
     """
     facade = self._getFacade()
     data = facade.getManufacturerData(uid)
     return DirectResponse(data=Zuul.marshal(data) ) 
 def getMembers(self, uid, keys=None):
     facade = self._getFacade()
     if keys is None:
         keys = ['severity', 'monitor', 'hidden', 'leaf', 'uid', 'text', 'id', 'path', 'iconCls', 'uuid', 'name', 'meta_type']
     data = facade.getMembers(uid)
     return DirectResponse(data=Zuul.marshal(data, keys), totalCount=len(data),
                           hash=len(data))
예제 #13
0
 def getSupportSettings(self):
     """
     Retrieves the collection of settings
     """
     settings = self._getSupportSettings()
     return DirectResponse.succeed(
         data=Zuul.marshal(settings.getSupportSettingsData()))
예제 #14
0
 def getProductData(self, uid, prodname):
     """
     return all extra data for product id
     """
     facade = self._getFacade()
     data = facade.getProductData(uid, prodname)
     return DirectResponse(data=Zuul.marshal(data) )
예제 #15
0
 def deleteMaintWindow(self, uid, id):
     """
     delete a maintenance window
     """
     facade = self._getFacade()
     data = facade.deleteMaintWindow(uid, id)
     return DirectResponse.succeed(data=Zuul.marshal(data))
예제 #16
0
 def deleteUserCommand(self, uid, id):
     """
     delete a user command
     """
     facade = self._getFacade()
     data = facade.deleteUserCommand(uid, id)
     return DirectResponse.succeed(data=Zuul.marshal(data))
예제 #17
0
 def isTransformEnabled(self, uid):
     """
     Returns True if transform is enabled, False if disabled.
     """
     facade = self._getFacade()
     data = facade.isTransformEnabled(uid)
     return DirectResponse(data=Zuul.marshal(data))
예제 #18
0
 def getManufacturers(self):
     """
     return all manufacturers
     """
     facade = self._getFacade()
     data = facade.getManufacturers()
     return DirectResponse(data=Zuul.marshal(data))
예제 #19
0
    def setInfo(self, **data):
        """
        Set attributes on an object.
        This method accepts any keyword argument for the property that you wish
        to set. The only required property is "uid".

        @type    uid: string
        @keyword uid: Unique identifier of an object
        @rtype:  DirectResponse
        @return: B{Properties}:
            - data: (dictionary) The modified object
        """
        uid = data['uid']
        del data['uid']
        obj = self._getFacade()._getObject(uid)
        passwordFields = self._getPasswordFields(obj)
        oldData = self._getInfoData(obj, data)
        info = self._getFacade().setInfo(uid, data)
        newData = self._getInfoData(obj, data)
        # Trac #29376: Consistently show thresholdType with threshold operations.
        thresholdType = obj.getTypeName() if isinstance(obj, ThresholdClass) else None
        audit(['UI', getDisplayType(obj), 'Edit'], obj, thresholdType=thresholdType,
              data_=newData, oldData_=oldData,
              skipFields_=('newId',), # special case in TemplateFacade.setInfo()
              maskFields_=passwordFields)  
        return DirectResponse.succeed(data=Zuul.marshal(info))
예제 #20
0
 def getUsers(self, keys=None, start=0, limit=50, page=0,
                 sort='name', dir='ASC', name=None):
     """
     Retrieves a list of users. This method supports pagination.
     @type  start: integer
     @param start: (optional) Offset to return the results from; used in
                   pagination (default: 0)
     @type  name: string
     @param name: (optional) filter to be applied to users returned (default: None)
     @type  limit: integer
     @param limit: (optional) Number of items to return; used in pagination
                   (default: 50)
     @type  sort: string
     @param sort: (optional) Key on which to sort the return results (default:
                  'name')
     @type  dir: string
     @param dir: (optional) Sort order; can be either 'ASC' or 'DESC'
                 (default: 'ASC')
     @rtype:   DirectResponse
     @return:  B{Properties}:
          - data: (list) Dictionaries of user properties
          - totalCount: (integer) Number of devices returned
     """
     facade = self._getFacade()
     users = facade.getUsers(start=start, limit=limit, sort=sort,
                             dir=dir, name=name)
     total = users.total
     data = Zuul.marshal(users, keys)
     return DirectResponse.succeed(data=data, totalCount=total)
예제 #21
0
    def queryArchive(self, page=None, limit=0, start=0, sort='lastTime', dir='desc', params=None, exclusion_filter=None, keys=None, uid=None, detailFormat=False):
        if not self._canViewEvents():
            return DirectResponse.succeed(
                events = [],
                totalCount = 0,
                asof = time.time()
                )

        filter = self._buildFilter([uid], params)
        if exclusion_filter is not None:
            exclusion_filter = self._buildFilter([uid], exclusion_filter)
        events = self.zep.getEventSummariesFromArchive(limit=limit, offset=start, sort=self._buildSort(sort,dir),
                                                       filter=filter, exclusion_filter=exclusion_filter)
        eventFormat = EventCompatInfo
        if detailFormat:
            eventFormat = EventCompatDetailInfo

        dmd = self.context.dmd
        # filter out the component and device UUIDs that no longer exist in our system
        evdata = self._filterInvalidUuids(events['events'])
        eventObs = [eventFormat(dmd, e) for e in evdata]
        return DirectResponse.succeed(
            events = Zuul.marshal(eventObs, keys),
            totalCount = events['total'],
            asof = time.time()
        )
예제 #22
0
 def getProductInstances(self, uid, id, params={}):
     """
     return all instances of this product
     """
     facade = self._getFacade()
     data = facade.getProductInstances(uid, id, params)
     return DirectResponse(data=Zuul.marshal(data) )        
예제 #23
0
    def getTree(self, id):
        """
        Returns the tree structure of the application and collector
        hierarchy.

        @type  id: string
        @param id: Id of the root node of the tree to be returned
        @rtype:   [dictionary]
        @return:  Object representing the tree
        """
        try:
            appfacade = self._getFacade()
            monitorfacade = Zuul.getFacade("monitors", self.context)
            nodes = [ITreeNode(m) for m in monitorfacade.query()]
            for monitor in nodes:
                apps = appfacade.queryMonitorDaemons(monitor.name)
                for app in apps:
                    monitor.addChild(IInfo(app))
            apps = appfacade.queryMasterDaemons()
            for app in apps:
                nodes.append(IInfo(app))
            return Zuul.marshal(nodes)
        except URLError as e:
            log.exception(e)
            return DirectResponse.fail("Error fetching daemons list: " +
                                       str(e.reason))
예제 #24
0
 def _correctReportTitles(self, data):
     data = Zuul.marshal(data)
     # show the context in the report title, otherwise the user
     # has no idea which component the graph is for
     for row in data:
         row['title'] = row['contextTitle']
     return DirectResponse(data=data)
예제 #25
0
 def isTransformEnabled(self, uid):
     """
     Returns True if transform is enabled, False if disabled.
     """
     facade = self._getFacade()
     data = facade.isTransformEnabled(uid)
     return DirectResponse(data=Zuul.marshal(data) )
예제 #26
0
    def getInstances(self, uid, start=0, params=None, limit=50, sort='name',
                     page=None, dir='ASC'):
        """
        Get a list of instances for a process UID.

        @type  uid: string
        @param uid: Process UID to get instances of
        @type  start: integer
        @param start: (optional) Offset to return the results from; used in
                      pagination (default: 0)
        @type  params: dictionary
        @param params: (optional) Key-value pair of filters for this search.
        @type  limit: integer
        @param limit: (optional) Number of items to return; used in pagination
                      (default: 50)
        @type  sort: string
        @param sort: (optional) Key on which to sort the return results (default:
                     'name')
        @type  dir: string
        @param dir: (optional) Sort order; can be either 'ASC' or 'DESC'
                    (default: 'ASC')
        @rtype:   DirectResponse
        @return:  B{Properties}:
             - data: ([dictionary]) List of objects representing process instances
             - total: (integer) Total number of instances
        """
        facade = self._getFacade()
        instances = facade.getInstances(uid, start, limit, sort, dir, params)
        keys = ['device', 'monitored', 'pingStatus', 'processName', 'name', 
                'uid', 'minProcessCount', 'maxProcessCount']
        data = Zuul.marshal(instances, keys)
        return DirectResponse.succeed(data=data, totalCount=instances.total)
예제 #27
0
 def getManufacturers(self):
     """
     return all manufacturers
     """
     facade = self._getFacade()
     data = facade.getManufacturers()
     return DirectResponse(data=Zuul.marshal(data))
예제 #28
0
 def deleteMaintWindow(self, uid, id):
     """
     delete a maintenance window
     """
     facade = self._getFacade()
     data = facade.deleteMaintWindow(uid, id)
     return DirectResponse.succeed(data=Zuul.marshal(data))           
예제 #29
0
 def getManufacturerList(self):
     """
     return a usable tree
     """
     facade = self._getFacade()
     data = facade.getManufacturerList()
     return DirectResponse(data=Zuul.marshal(data))
예제 #30
0
파일: zep.py 프로젝트: c0ns0le/zenoss-4
    def queryGenerator(self, sort='lastTime', dir='desc', evids=None, excludeIds=None, params=None,
                       archive=False, uid=None, detailFormat=False):
        """
        Query for events.

        @type  sort: string
        @param sort: (optional) Key on which to sort the return results (default:
                     'lastTime')
        @type  dir: string
        @param dir: (optional) Sort order; can be either 'ASC' or 'DESC'
                    (default: 'DESC')
        @type  params: dictionary
        @param params: (optional) Key-value pair of filters for this search.
                       (default: None)
        @type  archive: boolean
        @param archive: (optional) True to search the event archive instead
                        of active events (default: False)
        @type  uid: string
        @param uid: (optional) Context for the query (default: None)
        @rtype:   generator
        @return:  Generator returning events.
        """
        if not self._canViewEvents():
            return
        includeFilter, excludeFilter = self._buildRequestFilters(uid, params, evids, excludeIds)

        events = self.zep.getEventSummariesGenerator(filter=includeFilter, exclude=excludeFilter,
                                                      sort=self._buildSort(sort, dir), archive=archive)
        eventFormat = EventCompatInfo
        if detailFormat:
            eventFormat = EventCompatDetailInfo
        for event in events:
            yield Zuul.marshal(eventFormat(self.context.dmd, event))
예제 #31
0
    def getInstances(self, uid, start=0, params=None, limit=50, sort='name',
                     page=None, dir='ASC'):
        """
        Get a list of instances for a service UID.

        @type  uid: string
        @param uid: Service UID to get instances of
        @type  start: integer
        @param start: (optional) Offset to return the results from; used in
                      pagination (default: 0)
        @type  params: dictionary
        @param params: (optional) Key-value pair of filters for this search.
        @type  limit: integer
        @param limit: (optional) Number of items to return; used in pagination
                      (default: 50)
        @type  sort: string
        @param sort: (optional) Key on which to sort the return results (default:
                     'name')
        @type  dir: string
        @param dir: (optional) Sort order; can be either 'ASC' or 'DESC'
                    (default: 'ASC')
        @rtype:   DirectResponse
        @return:  B{Properties}:
             - data: ([dictionary]) List of objects representing service instances
             - totalCount: (integer) Total number of instances
        """
        if isinstance(params, basestring):
            params = unjson(params)
        instances = self.api.getInstances(uid, start=start, params=params,
                                          limit=limit, sort=sort, dir=dir)

        keys = ['description', 'device', 'locking', 'monitored', 'name',
                 'pingStatus', 'uid']
        data = Zuul.marshal(instances, keys)
        return DirectResponse.succeed(data=data, totalCount=instances.total)
예제 #32
0
 def getTransform(self, uid):
     """
     returns a transform for the context
     """
     facade = self._getFacade()
     data = facade.getTransform(uid)
     return DirectResponse(data=Zuul.marshal(data) )
예제 #33
0
 def getTransformTree(self, uid):
     """
     returns a transform for the context with all its inherited transforms
     """
     facade = self._getFacade()
     data = facade.getTransformTree(uid)
     return DirectResponse(data=Zuul.marshal(data) )
예제 #34
0
    def getInstances(self, uid, start=0, params=None, limit=50, sort='name',
                     page=None, dir='ASC'):
        """
        Get a list of instances for a process UID.

        @type  uid: string
        @param uid: Process UID to get instances of
        @type  start: integer
        @param start: (optional) Offset to return the results from; used in
                      pagination (default: 0)
        @type  params: dictionary
        @param params: (optional) Key-value pair of filters for this search.
        @type  limit: integer
        @param limit: (optional) Number of items to return; used in pagination
                      (default: 50)
        @type  sort: string
        @param sort: (optional) Key on which to sort the return results (default:
                     'name')
        @type  dir: string
        @param dir: (optional) Sort order; can be either 'ASC' or 'DESC'
                    (default: 'ASC')
        @rtype:   DirectResponse
        @return:  B{Properties}:
             - data: ([dictionary]) List of objects representing process instances
             - total: (integer) Total number of instances
        """
        facade = self._getFacade()
        instances = facade.getInstances(uid, start, limit, sort, dir, params)
        keys = ['device', 'monitored', 'pingStatus', 'processName', 'name', 'uid']
        data = Zuul.marshal(instances, keys)
        return DirectResponse.succeed(data=data, totalCount=instances.total)
예제 #35
0
 def getManufacturerData(self, uid):
     """
     return all extra data for manufacturer id
     """
     facade = self._getFacade()
     data = facade.getManufacturerData(uid)
     return DirectResponse(data=Zuul.marshal(data))
예제 #36
0
 def getProductInstances(self, uid, id, params={}):
     """
     return all instances of this product
     """
     facade = self._getFacade()
     data = facade.getProductInstances(uid, id, params)
     return DirectResponse(data=Zuul.marshal(data))
예제 #37
0
 def getEventsCounts(self, uid):
     """
     return all the event counts for this context
     """
     facade = self._getFacade()
     data = facade.getEventsCounts(uid)
     return DirectResponse(data=Zuul.marshal(data) )
예제 #38
0
파일: zep.py 프로젝트: c0ns0le/zenoss-4
    def queryArchive(self, page=None, limit=0, start=0, sort='lastTime', dir='desc', params=None, exclusion_filter=None, keys=None, uid=None, detailFormat=False):
        if not self._canViewEvents():
            return DirectResponse.succeed(
                events=[],
                totalCount=0,
                asof=time.time()
                )

        filter = self._buildFilter(uid, params)
        if exclusion_filter is not None:
            exclusion_filter = self._buildFilter(uid, exclusion_filter)
        events = self.zep.getEventSummariesFromArchive(limit=limit, offset=start, sort=self._buildSort(sort, dir),
                                                       filter=filter, exclusion_filter=exclusion_filter)
        eventFormat = EventCompatInfo
        if detailFormat:
            eventFormat = EventCompatDetailInfo

        dmd = self.context.dmd
        # filter out the component and device UUIDs that no longer exist in our system
        evdata = self._filterInvalidUuids(events['events'])
        eventObs = [eventFormat(dmd, e) for e in evdata]
        return DirectResponse.succeed(
            events=Zuul.marshal(eventObs, keys),
            totalCount=events['total'],
            asof=time.time()
        )
예제 #39
0
파일: users.py 프로젝트: bbc/zenoss-prodbin
 def getUsers(self, keys=None, start=0, limit=50, page=0,
                 sort='name', dir='ASC', name=None):
     """
     Retrieves a list of users. This method supports pagination.
     @type  start: integer
     @param start: (optional) Offset to return the results from; used in
                   pagination (default: 0)
     @type  name: string
     @param name: (optional) filter to be applied to users returned (default: None)
     @type  limit: integer
     @param limit: (optional) Number of items to return; used in pagination
                   (default: 50)
     @type  sort: string
     @param sort: (optional) Key on which to sort the return results (default:
                  'name')
     @type  dir: string
     @param dir: (optional) Sort order; can be either 'ASC' or 'DESC'
                 (default: 'ASC')
     @rtype:   DirectResponse
     @return:  B{Properties}:
          - data: (list) Dictionaries of user properties
          - totalCount: (integer) Number of devices returned
     """
     facade = self._getFacade()
     users = facade.getUsers(start=start, limit=limit, sort=sort,
                             dir=dir, name=name)
     total = users.total
     data = Zuul.marshal(users, keys)
     return DirectResponse.succeed(data=data, totalCount=total)
예제 #40
0
 def getTransformTree(self, uid):
     """
     returns a transform for the context with all its inherited transforms
     """
     facade = self._getFacade()
     data = facade.getTransformTree(uid)
     return DirectResponse(data=Zuul.marshal(data))
예제 #41
0
 def getUserInterfaceSettings(self):
     """
     Retrieves the collection of User interface settings
     """
     settings = self._getUISettings()
     return DirectResponse.succeed(
         data=Zuul.marshal(settings.getSettingsData()))
예제 #42
0
 def getInstanceData(self, uid):
     """
     return all extra data for instance id
     """
     facade = self._getFacade()
     data = facade.getInstanceData(uid)
     return DirectResponse(data=Zuul.marshal(data))
예제 #43
0
 def getEventsCounts(self, uid):
     """
     return all the event counts for this context
     """
     facade = self._getFacade()
     data = facade.getEventsCounts(uid)
     return DirectResponse(data=Zuul.marshal(data))
예제 #44
0
    def getIpAddresses(self, uid, start=0, params=None, limit=50, sort='ipAddressAsInt',
                       page=None, dir='ASC'):
        """
        Given a subnet, get a list of IP addresses and their relations.

        @type  uid: string
        @param uid: Unique identifier of a subnet
        @type  start: integer
        @param start: Offset to return the results from; used in pagination
        @type  params: string
        @param params: Not used
        @type  limit: integer
        @param limit: Number of items to return; used in pagination
        @type  sort: string
        @param sort: (optional) Key on which to sort the return results;
                     defaults to 'name'
        @type  order: string
        @param order: Sort order; can be either 'ASC' or 'DESC'
        @rtype: DirectResponse
        """
        if isinstance(params, basestring):
            params = unjson(params)
        instances = self.api.getIpAddresses(uid=uid, start=start, params=params,
                                          limit=limit, sort=sort, dir=dir)

        keys = ['name', 'netmask', 'pingstatus', 'snmpstatus', 'uid',
                'device', 'interface', 'macAddress',
                'interfaceDescription', 'manageDevice']
        data = Zuul.marshal(instances.results, keys)
        return DirectResponse.succeed(data=data, totalCount=instances.total,
                                      hash=instances.hash_)
예제 #45
0
 def getTransform(self, uid):
     """
     returns a transform for the context
     """
     facade = self._getFacade()
     data = facade.getTransform(uid)
     return DirectResponse(data=Zuul.marshal(data))
예제 #46
0
 def getProductData(self, uid, prodname):
     """
     return all extra data for product id
     """
     facade = self._getFacade()
     data = facade.getProductData(uid, prodname)
     return DirectResponse(data=Zuul.marshal(data))
예제 #47
0
    def getTree(self, id):
        """
        Returns the tree structure of the application and collector
        hierarchy.

        @type  id: string
        @param id: Id of the root node of the tree to be returned
        @rtype:   [dictionary]
        @return:  Object representing the tree
        """
        try:
            appfacade = self._getFacade()
            monitorfacade = Zuul.getFacade("monitors", self.context)
            nodes = [ITreeNode(m) for m in monitorfacade.query()]
            for monitor in nodes:
                apps = appfacade.queryMonitorDaemons(monitor.name)
                for app in apps:
                    monitor.addChild(IInfo(app))
            apps = appfacade.queryMasterDaemons()
            for app in apps:
                nodes.append(IInfo(app))
            return Zuul.marshal(nodes)
        except URLError as e:
            log.exception(e)
            return DirectResponse.fail(
                "Error fetching daemons list: " + str(e.reason)
            )
예제 #48
0
 def deleteUserCommand(self, uid, id):
     """
     delete a user command
     """
     facade = self._getFacade()
     data = facade.deleteUserCommand(uid, id)
     return DirectResponse.succeed(data=Zuul.marshal(data))         
예제 #49
0
    def setInfo(self, **data):
        """
        Set attributes on an object.
        This method accepts any keyword argument for the property that you wish
        to set. The only required property is "uid".

        @type    uid: string
        @keyword uid: Unique identifier of an object
        @rtype:  DirectResponse
        @return: B{Properties}:
            - data: (dictionary) The modified object
        """
        uid = data['uid']
        del data['uid']
        obj = self._getFacade()._getObject(uid)
        oldData = self._getInfoData(obj, data)
        info = self._getFacade().setInfo(uid, data)
        newData = self._getInfoData(obj, data)
        # Trac #29376: Consistently show thresholdType with threshold operations.
        thresholdType = obj.getTypeName() if isinstance(
            obj, ThresholdClass) else None
        audit(['UI', getDisplayType(obj), 'Edit'],
              obj,
              thresholdType=thresholdType,
              data_=newData,
              oldData_=oldData,
              skipFields_=(
                  'newId', ))  # special case in TemplateFacade.setInfo()
        return DirectResponse.succeed(data=Zuul.marshal(info))
예제 #50
0
 def getInstanceData(self, uid):
     """
     return all extra data for instance id
     """
     facade = self._getFacade()
     data = facade.getInstanceData(uid)
     return DirectResponse(data=Zuul.marshal(data) )
예제 #51
0
 def getSequence(self, uid):
     """
     returns the sequence order of keys for a given instance
     """
     facade = self._getFacade()
     data = facade.getSequence(uid)
     audit('UI.EventClasses.SetSequence', uid, data_=data)
     return DirectResponse(data=Zuul.marshal(data))
예제 #52
0
    def getInstances(self, uid, params=None):
        """
        Returns event class mappings for the current context
        """
        facade = self._getFacade()
        data = facade.getInstances(uid)

        return DirectResponse(data=Zuul.marshal(data))
예제 #53
0
 def getSequence(self, uid):
     """
     returns the sequence order of keys for a given instance
     """
     facade = self._getFacade()
     data = facade.getSequence(uid)
     audit('UI.EventClasses.SetSequence', uid, data_=data)
     return DirectResponse(data=Zuul.marshal(data) )
예제 #54
0
    def getInstances(self, uid, params=None):
        """
        Returns event class mappings for the current context
        """
        facade = self._getFacade()
        data = facade.getInstances(uid)

        return DirectResponse( data=Zuul.marshal(data) )
예제 #55
0
 def addNewInstance(self, params=None):
     """
     Add new event class mapping for the current context
     """
     facade = self._getFacade()
     newInstance = facade.addNewInstance(params)
     audit('UI.EventClasses.AddInstance', params['newName'], data_=params)
     return DirectResponse.succeed(data=Zuul.marshal(newInstance))
예제 #56
0
 def getApplicationConfigFiles(self, id):
     """
     Returns all the configuration files for an application
     """
     facade = self._getFacade()
     info = IInfo(facade.get(id))
     files = info.configFiles
     return DirectResponse.succeed(data=Zuul.marshal(files))
예제 #57
0
    def getProductsByManufacturer(self, uid, params={}):
        """
        Returns products for the current context
        """
        facade = self._getFacade()
        data = facade.getProductsByManufacturer(uid, params)

        return DirectResponse( data=Zuul.marshal(data) )
예제 #58
0
    def getProductsByManufacturer(self, uid, params={}):
        """
        Returns products for the current context
        """
        facade = self._getFacade()
        data = facade.getProductsByManufacturer(uid, params)

        return DirectResponse(data=Zuul.marshal(data))