本文整理匯總了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