a | b | |
---|
| 0 | + | def view_rp(request, slug, envt, status, datacenter): |
---|
| 0 | + | envt_template = 'cyclo/rp_ville_'+status+'.txt' |
---|
| 0 | + | |
---|
| 0 | + | stown = Town.objects.get(slug=slug); |
---|
| 0 | + | if envt =="prod": |
---|
| 0 | + | for rp in stown.prod_rp.all(): |
---|
| 0 | + | if rp.datacenter.slug == datacenter: |
---|
| 0 | + | rpwwwip = rp.http_www |
---|
| 0 | + | rpaboip = rp.https_abo |
---|
| 0 | + | |
---|
| 0 | + | frontal_ip_list =[] |
---|
| 0 | + | for frontal in stown.prod_frontal.all(): |
---|
| 0 | + | if frontal.datacenter.slug == datacenter: |
---|
| 0 | + | frontal_ip_list.append(frontal.ip) |
---|
| 0 | + | |
---|
| 0 | + | elif envt == "preprod": |
---|
| 0 | + | for rp in stown.preprod_rp.all(): |
---|
| 0 | + | if rp.datacenter.slug == datacenter: |
---|
| 0 | + | rpwwwip = rp.http_www |
---|
| 0 | + | rpaboip = rp.https_abo |
---|
| 0 | + | |
---|
| 0 | + | frontal_ip_list =[] |
---|
| 0 | + | for frontal in stown.preprod_frontal.all(): |
---|
| 0 | + | if frontal.datacenter.slug == datacenter: |
---|
| 0 | + | frontal_ip_list.append(frontal.ip) |
---|
| 0 | + | |
---|
| 0 | + | elif envt == "vabf": |
---|
| 0 | + | for rp in stown.vabf_rp.all(): |
---|
| 0 | + | if rp.datacenter.slug == datacenter: |
---|
| 0 | + | rpwwwip = rp.http_www |
---|
| 0 | + | rpaboip = rp.https_abo |
---|
| 0 | + | |
---|
| 0 | + | frontal_ip_list =[] |
---|
| 0 | + | for frontal in stown.vabf_frontal.all(): |
---|
| 0 | + | if frontal.datacenter.slug == datacenter: |
---|
| 0 | + | frontal_ip_list.append(frontal.ip) |
---|
| 0 | + | |
---|
| 0 | + | return object_detail( |
---|
| 0 | + | request, |
---|
| 0 | + | queryset = Town.objects.all(), |
---|
| 0 | + | slug= slug, |
---|
| 0 | + | template_name = envt_template, |
---|
| 0 | + | mimetype='text/plain', |
---|
| 0 | + | extra_context = { |
---|
| 0 | + | "rpwwwip": rpwwwip, |
---|
| 0 | + | "rpaboip": rpaboip, |
---|
| 0 | + | "frontal_ip_list": frontal_ip_list, |
---|
| 0 | + | } |
---|
| 0 | + | ) |
---|
... | |
---|