本文整理汇总了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