@@ -62,38 +62,47 @@ def post(self, request, *args, **kwargs):
6262 else :
6363 return self .vm_by_line_database_report ()
6464
65-
6665 def vm_by_line_database_report (self ):
6766
68- header = ['Name' , 'VM' , 'Env' , 'Team' , 'Created At' , 'In Quarantine' , 'Apps Bind Name' ]
67+ header = ['Name' , 'VM' , 'Env' , 'Team' , 'Team Name' , 'Email' , 'Emergency Contacts' ,
68+ 'Team Organization' , 'Created At' , 'In Quarantine' , 'Apps Bind Name' ]
69+
6970 databases = Database .objects .all ()
7071 response = HttpResponse (content_type = 'text/csv' )
7172
7273 filename = 'dbaas_databases_vm_by_line-' + datetime .now ().strftime ("%Y-%m-%d" ) + ".csv"
7374
74- response ['Content-Disposition' ] = 'attachment; filename="' + filename + '"'
75+ response ['Content-Disposition' ] = 'attachment; filename="' + filename + '"'
7576 writer = csv .writer (response , csv .excel )
7677 response .write (u'\ufeff ' .encode ('utf8' ))
7778 writer .writerow (header )
7879
7980 for database in databases :
8081 for instance in database .infra .instances .all ():
81- data = [database .name , instance .hostname .hostname .encode ("utf-8" ), database .environment ,
82+ data = [database .name ,
83+ instance .hostname .hostname .encode ("utf-8" ),
84+ database .environment ,
8285 database .team ,
83- database .created_at , database .is_in_quarantine , database .apps_bind_name ]
86+ database .team .name ,
87+ database .team .email ,
88+ database .team .contacts ,
89+ database .team .organization .name ,
90+ database .created_at ,
91+ database .is_in_quarantine ,
92+ database .apps_bind_name ]
8493 writer .writerow (data )
85-
86-
94+
8795 return response
8896
8997 def default_database_report (self ):
9098
91- header = ['Name' , 'VM' , 'Env' , 'Team' , 'Created At' , 'In Quarantine' , 'Apps Bind Name' ]
99+ header = ['Name' , 'VM' , 'Env' , 'Team' , 'Team Name' , 'Email' , 'Emergency Contacts' ,
100+ 'Team Organization' , 'Created At' , 'In Quarantine' , 'Apps Bind Name' ]
92101 databases = Database .objects .all ()
93102 response = HttpResponse (content_type = 'text/csv' )
94103
95104 filename = 'dbaas_databases-' + datetime .now ().strftime ("%Y-%m-%d" ) + ".csv"
96- response ['Content-Disposition' ] = 'attachment; filename="' + filename + '"'
105+ response ['Content-Disposition' ] = 'attachment; filename="' + filename + '"'
97106
98107 writer = csv .writer (response , csv .excel )
99108 response .write (u'\ufeff ' .encode ('utf8' ))
@@ -102,8 +111,17 @@ def default_database_report(self):
102111 for database in databases :
103112 hostname = [instance .hostname .hostname .encode ("utf-8" ) for instance in
104113 database .infra .instances .all ()]
105- data = [database .name , hostname , database .environment , database .team ,
106- database .created_at , database .is_in_quarantine , database .apps_bind_name ]
114+ data = [database .name ,
115+ hostname ,
116+ database .environment ,
117+ database .team ,
118+ database .team .name ,
119+ database .team .email ,
120+ database .team .contacts ,
121+ database .team .organization .name ,
122+ database .created_at ,
123+ database .is_in_quarantine ,
124+ database .apps_bind_name ]
107125 writer .writerow (data )
108-
126+
109127 return response
0 commit comments