当前位置: 首页>>代码示例>>Python>>正文


Python Config.labels方法代码示例

本文整理汇总了Python中cattle.Config.labels方法的典型用法代码示例。如果您正苦于以下问题:Python Config.labels方法的具体用法?Python Config.labels怎么用?Python Config.labels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cattle.Config的用法示例。


在下文中一共展示了Config.labels方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_host_labels

# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import labels [as 别名]
    def _get_host_labels(self):
        try:
            labels = self.host_info.host_labels()
        except:
            log.exception("Error getting host labels")

        if Config.labels():
            labels.update(Config.labels())

        return labels
开发者ID:keras,项目名称:python-agent,代码行数:12,代码来源:compute.py

示例2: _add_resources

# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import labels [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'
        }

        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)
开发者ID:vladimir-romaniuk,项目名称:python-agent,代码行数:47,代码来源:compute.py

示例3: _add_resources

# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import labels [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)
开发者ID:dx9,项目名称:python-agent,代码行数:45,代码来源:compute.py

示例4: _get_host_create_labels

# 需要导入模块: from cattle import Config [as 别名]
# 或者: from cattle.Config import labels [as 别名]
 def _get_host_create_labels(self):
     labels = Config.labels()
     if labels:
         return labels
     return {}
开发者ID:cjellick,项目名称:python-agent,代码行数:7,代码来源:compute.py


注:本文中的cattle.Config.labels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。