#NEWLINE# def get_encoded_zip( self , project_id ) : #NEWLINE# #INDENT# tmpfolder = tempfile . mkdtemp ( ) #NEWLINE# filename = 'payload.zip' #NEWLINE# zippath = os . path . join ( tmpfolder , filename ) #NEWLINE# z = zipfile . ZipFile ( zippath , 'w' , zipfile . ZIP_DEFLATED ) #NEWLINE# shellfile = open ( FLAGS . boot_script_template , 'r' ) #NEWLINE# s = string . Template ( shellfile . read ( ) ) #NEWLINE# shellfile . close ( ) #NEWLINE# boot_script = s . substitute ( cc_dmz = FLAGS . ec2_dmz_host , cc_port = FLAGS . ec2_port , dmz_net = FLAGS . dmz_net , dmz_mask = FLAGS . dmz_mask , num_vpn = FLAGS . cnt_vpn_clients ) #NEWLINE# crypto . generate_vpn_files ( project_id ) #NEWLINE# z . writestr ( 'autorun.sh' , boot_script ) #NEWLINE# crl = os . path . join ( crypto . ca_folder ( project_id ) , 'crl.pem' ) #NEWLINE# z . write ( crl , 'crl.pem' ) #NEWLINE# server_key = os . path . join ( crypto . ca_folder ( project_id ) , 'server.key' ) #NEWLINE# z . write ( server_key , 'server.key' ) #NEWLINE# ca_crt = os . path . join ( crypto . ca_path ( project_id ) ) #NEWLINE# z . write ( ca_crt , 'ca.crt' ) #NEWLINE# server_crt = os . path . join ( crypto . ca_folder ( project_id ) , 'server.crt' ) #NEWLINE# z . write ( server_crt , 'server.crt' ) #NEWLINE# z . close ( ) #NEWLINE# zippy = open ( zippath , 'r' ) #NEWLINE# encoded = zippy . read ( ) . encode ( 'base64' ) . encode ( 'base64' ) #NEWLINE# zippy . close ( ) #NEWLINE# return encoded