@@ -1188,8 +1188,10 @@ def create_instance(compute, project, zone, test, reportURL) -> Dict:
11881188 if test .platform == TestPlatform .linux :
11891189 image_response = compute .images ().getFromFamily (project = config .get ('LINUX_INSTANCE_PROJECT_NAME' , '' ),
11901190 family = config .get ('LINUX_INSTANCE_FAMILY_NAME' , '' )).execute ()
1191- startup_script = open (os .path .join (config .get ('INSTALL_FOLDER' , '' ), 'install' , 'ci-vm' ,
1192- 'ci-linux' , 'startup-script.sh' ), 'r' ).read ()
1191+ with open (os .path .join (
1192+ config .get ('INSTALL_FOLDER' , '' ), 'install' , 'ci-vm' ,
1193+ 'ci-linux' , 'startup-script.sh' ), 'r' ) as f :
1194+ startup_script = f .read ()
11931195 metadata_items = [
11941196 {'key' : 'startup-script' , 'value' : startup_script },
11951197 {'key' : 'reportURL' , 'value' : reportURL },
@@ -1198,12 +1200,18 @@ def create_instance(compute, project, zone, test, reportURL) -> Dict:
11981200 elif test .platform == TestPlatform .windows :
11991201 image_response = compute .images ().getFromFamily (project = config .get ('WINDOWS_INSTANCE_PROJECT_NAME' , '' ),
12001202 family = config .get ('WINDOWS_INSTANCE_FAMILY_NAME' , '' )).execute ()
1201- startup_script = open (os .path .join (config .get ('INSTALL_FOLDER' , '' ), 'install' , 'ci-vm' ,
1202- 'ci-windows' , 'startup-script.ps1' ), 'r' ).read ()
1203- service_account = open (os .path .join (config .get ('INSTALL_FOLDER' , '' ),
1204- config .get ('SERVICE_ACCOUNT_FILE' , '' )), 'r' ).read ()
1205- rclone_conf = open (os .path .join (config .get ('INSTALL_FOLDER' , '' ), 'install' , 'ci-vm' ,
1206- 'ci-windows' , 'rclone.conf' ), 'r' ).read ()
1203+ with open (os .path .join (
1204+ config .get ('INSTALL_FOLDER' , '' ), 'install' , 'ci-vm' ,
1205+ 'ci-windows' , 'startup-script.ps1' ), 'r' ) as f :
1206+ startup_script = f .read ()
1207+ with open (os .path .join (
1208+ config .get ('INSTALL_FOLDER' , '' ),
1209+ config .get ('SERVICE_ACCOUNT_FILE' , '' )), 'r' ) as f :
1210+ service_account = f .read ()
1211+ with open (os .path .join (
1212+ config .get ('INSTALL_FOLDER' , '' ), 'install' , 'ci-vm' ,
1213+ 'ci-windows' , 'rclone.conf' ), 'r' ) as f :
1214+ rclone_conf = f .read ()
12071215 metadata_items = [
12081216 {'key' : 'windows-startup-script-ps1' , 'value' : startup_script },
12091217 {'key' : 'service_account' , 'value' : service_account },
0 commit comments