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