本文整理汇总了Python中application.Application.init_classes方法的典型用法代码示例。如果您正苦于以下问题:Python Application.init_classes方法的具体用法?Python Application.init_classes怎么用?Python Application.init_classes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类application.Application
的用法示例。
在下文中一共展示了Application.init_classes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from application import Application [as 别名]
# 或者: from application.Application import init_classes [as 别名]
def setUp(self):
self.generator = Generator()
self.generator.setup_logging()
self.hosts = {}
self.applications = {}
Application.init_classes([
os.path.join(os.path.dirname(__file__), '../recipes/default/classes'),
os.path.join(os.path.dirname(__file__), 'recipes/test10/classes')])
MonitoringDetail.init_classes([
os.path.join(os.path.dirname(__file__), '../recipes/default/classes'),
os.path.join(os.path.dirname(__file__), 'recipes/test10/classes')])
pass
row = ['drivelsrv', '11.120.9.10', 'Server', 'Red Hat 6.0', '', 'vs', '7x24', '2nd floor', 'ps']
final_row = { }
for (index, value) in enumerate(['host_name', 'address', 'type', 'os', 'hardware', 'virtual', 'notification_period', 'location', 'department']):
final_row[value] = [None if row[index] == "" else row[index]][0]
h = Host(final_row)
self.hosts[h.host_name] = h
row = ['drivel', 'mysql', '', '', '', 'drivelsrv', '7x24']
final_row = { }
for (index, value) in enumerate(['name', 'type', 'component', 'version', 'patchlevel', 'host_name', 'check_period']):
final_row[value] = [None if row[index] == "" else row[index]][0]
a = Application(final_row)
#a.__init__(final_row)
self.applications[a.fingerprint()] = a
setattr(a, "host", self.hosts[a.host_name])
示例2: init_class_cache
# 需要导入模块: from application import Application [as 别名]
# 或者: from application.Application import init_classes [as 别名]
def init_class_cache(self):
Datasource.init_classes(self.classes_path)
logger.debug("init Datasource classes (%d)" % len(Datasource.class_factory))
Datarecipient.init_classes(self.classes_path)
logger.debug("init Datarecipient classes (%d)" % len(Datarecipient.class_factory))
Application.init_classes(self.classes_path)
logger.debug("init Application classes (%d)" % len(Application.class_factory))
MonitoringDetail.init_classes(self.classes_path)
logger.debug("init MonitoringDetail classes (%d)" % len(MonitoringDetail.class_factory))
示例3: test_detail_ram
# 需要导入模块: from application import Application [as 别名]
# 或者: from application.Application import init_classes [as 别名]
def test_detail_ram(self):
Application.init_classes([
os.path.join(os.path.dirname(__file__), 'recipes/test6/classes'),
os.path.join(os.path.dirname(__file__), '../recipes/default/classes')])
MonitoringDetail.init_classes([
os.path.join(os.path.dirname(__file__), 'recipes/test6/classes'),
os.path.join(os.path.dirname(__file__), '../recipes/default/classes')])
self.print_header()
opsys = Application({'name': 'os', 'type': 'red hat 6.1'})
ram = MonitoringDetail({'application_name': 'os',
'application_type': 'red hat 6.1',
'monitoring_type': 'RAM',
'monitoring_0': '80',
'monitoring_1': '90',
})
opsys.monitoring_details.append(ram)
for m in opsys.monitoring_details:
print "detail", m
opsys.resolve_monitoring_details()
self.assert_(hasattr(opsys, 'ram'))
self.assert_(opsys.ram.warning == '80')