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


Python Misc.change_domain_to_local方法代码示例

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


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

示例1: info_all

# 需要导入模块: from misc import Misc [as 别名]
# 或者: from misc.Misc import change_domain_to_local [as 别名]
 def info_all(self):
     elbs = self.get_all_elbs()
     result = []
     yaml = Misc.get_aws_yaml(yaml_file="elb")
     V = Vpc()
     for lb in elbs:
         tmp = lb['LoadBalancerName'].split('-')
         if len(tmp) >= 3:
             elb_env = tmp.pop(0)
             short_env = tmp.pop(0)
             elb_stack = "-".join(tmp)
         elb_facing = lb['Scheme']
         if elb_stack in yaml and elb_facing in yaml[elb_stack]:
             yaml_info = yaml[elb_stack][elb_facing]
             v = V.get_vpc_from_env(env=elb_env)
             domain = Misc.get_value_from_array_hash(dictlist=v.get('Tags'), key="Domain")
             if elb_facing == "internet-facing":
                 elb_dns_name = yaml_info['dns'] + "." + Misc.change_domain_to_local(domain=domain)
             elif elb_facing == "internal":
                 elb_dns_name = yaml_info['dns'] + "." + Misc.change_domain_to_local(domain=domain)
         else:
             elb_dns_name = None
         info = {}
         if elb_dns_name is not None:
             info['DNS cname'] = elb_dns_name
         else:
             info['DNS cname'] = "This elb is not in automatisation framework. Will be decomissioned"
         info['Xively_service'] = Misc.get_value_from_array_hash(dictlist=lb.get('Tags'), key="Xively_service")
         info['Puppet_role'] = Misc.get_value_from_array_hash(dictlist=lb.get('Tags'), key="Puppet_role")
         info['Env'] = Misc.get_value_from_array_hash(dictlist=lb.get('Tags'), key="Environment")
         info['Real endpoint'] = lb['DNSName']
         info['Vpcid'] = lb['VPCId']
         info['Name'] = lb['LoadBalancerName']
         info['CreateTime'] = lb['CreatedTime'].strftime("%Y-%m-%d %H:%M")
         info['Facing'] = elb_facing
         info['Availability Zones'] = lb['AvailabilityZones']
         info['Securitygroups'] = lb['SecurityGroups']
         instance = []
         for i in lb['Instances']:
             instance.append(i['InstanceId'])
         info['InstanceIds'] = instance
         listen = []
         for listener in lb['ListenerDescriptions']:
             listener = listener['Listener']
             listen.append(
                 "%s-%s-%s" % (listener['LoadBalancerPort'], listener['InstancePort'], listener['Protocol']))
         info['From-To-Protocol'] = listen
         result.append(info)
     return result
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:51,代码来源:elb.py


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