예제 #1
0
    def afterSetUp(self):
        super(TestObjects, self).afterSetUp()

        map(self.dmd.Devices.createOrganizer, (DEVICECLASS_DEPENDENCIES))
        map(self.dmd.Events.createOrganizer, (EVENTCLASS_DEPENDENCIES))
        map(self.dmd.Reports.createOrganizer, (REPORTCLASS_DEPENDENCIES))

        self.dmd.REQUEST = None

        from Products.ZenRelations.ImportRM import NoLoginImportRM
        im = NoLoginImportRM(self.app)

        for zenpack in ZENPACK_DEPENDENCIES:
            __import__(zenpack)
            zp_module = sys.modules[zenpack]

            objects_file = '%s/objects/objects.xml' % zp_module.__path__[0]

            if os.path.isfile(objects_file):
                log.info('Loading objects for %s.', zenpack)
                im.loadObjectFromXML(objects_file)

        # Required to prevent erroring out when trying to define viewlets in
        # ../browser/configure.zcml.
        import zope.viewlet
        zcml.load_config('meta.zcml', zope.viewlet)

        import ZenPacks.zenoss.CloudStack
        zcml.load_config('configure.zcml', ZenPacks.zenoss.CloudStack)
예제 #2
0
            def devImport(xmlfile):
                """
                Load a new device from a file.

                @param xmlfile: file type object
                @type xmlfile: file type object
                """
                im = NoLoginImportRM(target.devices)
                im.loadObjectFromXML(xmlfile)
                im.processLinks()
예제 #3
0
 def _persistDataSource(self, datasource):
     """after switching the __class__ attribute, call this function to make the
     change permanent"""
     id = datasource.id
     from cStringIO import StringIO
     xml_file = StringIO()
     datasource.exportXml(xml_file)
     parent = datasource.getPrimaryParent()
     parent._delObject(datasource.id)
     from Products.ZenRelations.ImportRM import NoLoginImportRM
     xml_importer = NoLoginImportRM(parent)
     xml_file.seek(0)
     xml_importer.loadObjectFromXML(xml_file)
     xml_importer.processLinks()
     ds = parent._getOb(id)
     notify(IndexingEvent(ds))
예제 #4
0
    def afterSetUp(self):
        super(TestPack, self).afterSetUp()
        map(self.dmd.Devices.createOrganizer, (DEVICECLASS_DEPENDENCIES))

        self.dmd.REQUEST = None

        from Products.ZenRelations.ImportRM import NoLoginImportRM
        im = NoLoginImportRM(self.app)

        for zenpack in ZENPACK_DEPENDENCIES:
            __import__(zenpack)
            zp_module = sys.modules[zenpack]

            objects_file = '%s/objects/objects.xml' % zp_module.__path__[0]

            if os.path.isfile(objects_file):
                log.info('Loading objects for %s.', zenpack)
                im.loadObjectFromXML(objects_file)

        self.dc = self.dmd.Devices.Server.WebLogic