本文整理汇总了Python中cattle.Config.host_proxy方法的典型用法代码示例。如果您正苦于以下问题:Python Config.host_proxy方法的具体用法?Python Config.host_proxy怎么用?Python Config.host_proxy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cattle.Config
的用法示例。
在下文中一共展示了Config.host_proxy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _add_resources
# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import host_proxy [as 别名]
def _add_resources(self, ping, pong):
if not utils.ping_include_resources(ping):
return
stats = None
if utils.ping_include_stats(ping):
try:
stats = self.host_info.collect_data()
except:
log.exception("Error getting host info stats")
physical_host = Config.physical_host()
compute = {
'type': 'host',
'kind': 'docker',
'name': Config.hostname(),
'createLabels': self._get_host_create_labels(),
'labels': self._get_host_labels(),
'physicalHostUuid': physical_host['uuid'],
'uuid': DockerConfig.docker_uuid(),
'info': stats
}
pool = {
'type': 'storagePool',
'kind': 'docker',
'name': compute['name'] + ' Storage Pool',
'hostUuid': compute['uuid'],
'uuid': compute['uuid'] + '-pool'
}
resolved_ip = socket.gethostbyname(DockerConfig.docker_host_ip())
ip = {
'type': 'ipAddress',
'uuid': resolved_ip,
'address': resolved_ip,
'hostUuid': compute['uuid'],
}
proxy = Config.host_proxy()
if proxy is not None:
compute['apiProxy'] = proxy
utils.ping_add_resources(pong, physical_host, compute, pool, ip)
示例2: _add_resources
# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import host_proxy [as 别名]
def _add_resources(self, ping, pong):
if not utils.ping_include_resources(ping):
return
stats = None
if utils.ping_include_stats(ping):
try:
stats = self.host_info.collect_data()
except:
log.exception("Error geting host info stats")
physical_host = Config.physical_host()
compute = {
"type": "host",
"kind": "docker",
"name": Config.hostname(),
"labels": Config.labels(),
"physicalHostUuid": physical_host["uuid"],
"uuid": DockerConfig.docker_uuid(),
"info": stats,
}
pool = {
"type": "storagePool",
"kind": "docker",
"name": compute["name"] + " Storage Pool",
"hostUuid": compute["uuid"],
"uuid": compute["uuid"] + "-pool",
}
ip = {
"type": "ipAddress",
"uuid": DockerConfig.docker_host_ip(),
"address": DockerConfig.docker_host_ip(),
"hostUuid": compute["uuid"],
}
proxy = Config.host_proxy()
if proxy is not None:
compute["apiProxy"] = proxy
utils.ping_add_resources(pong, physical_host, compute, pool, ip)