本文整理汇总了Python中calico.felix.config.Config.update_config方法的典型用法代码示例。如果您正苦于以下问题:Python Config.update_config方法的具体用法?Python Config.update_config怎么用?Python Config.update_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calico.felix.config.Config
的用法示例。
在下文中一共展示了Config.update_config方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_default_config
# 需要导入模块: from calico.felix.config import Config [as 别名]
# 或者: from calico.felix.config.Config import update_config [as 别名]
def test_default_config(self):
"""
Test various ways of defaulting config.
"""
files = [ "felix_missing.cfg", # does not exist
"felix_empty.cfg", # empty file
"felix_empty_section.cfg", # file with empty section
"felix_extra.cfg", # extra config is just logged
]
for filename in files:
host = socket.gethostname()
host_path = "/calico/host/%s/config/" % host
config = Config("calico/felix/test/data/%s" % filename)
cfg_dict = { "InterfacePrefix": "blah",
"ExtraJunk": "whatever", #ignored
"ResyncIntervalSecs": "123" }
config.update_config(cfg_dict)
# Test defaulting.
self.assertEqual(config.ETCD_ADDR, "localhost:4001")
self.assertEqual(config.HOSTNAME, host)
self.assertEqual(config.IFACE_PREFIX, "blah")
self.assertEqual(config.RESYNC_INT_SEC, 123)
示例2: test_no_logfile
# 需要导入模块: from calico.felix.config import Config [as 别名]
# 或者: from calico.felix.config.Config import update_config [as 别名]
def test_no_logfile(self):
# Logging to file can be excluded by explicitly saying "none"
host = socket.gethostname()
host_path = "/calico/host/%s/config/" % host
result = StubEtcdResult("/calico/config/")
result.add_child("InterfacePrefix", "blah")
result.add_child("LogFilePath", "NoNe")
result = StubEtcdResult(host_path)
config = Config("calico/felix/test/data/felix_missing.cfg")
cfg_dict = { "InterfacePrefix": "blah",
"LogFilePath": "None",
"ResyncIntervalSecs": "123" }
config.update_config(cfg_dict)
self.assertEqual(config.LOGFILE, None)