cos-gpu-installer: reference locked file in the main function

Sending https requests might trigger Go garbage collection and
close unrefernced locked file so that the lock is released.
This results in allowing two installer instances running in one VM.

This CL makes the main function reference the locked file
and explicitly close it so that the lock won't be accidentally
released.

BUG=b/237702412
TEST=Repeatedly trying to start a second installer during
the driver installation process.

Change-Id: I2654c2d280eebc64815849820a31aef774ad96fa
Reviewed-on: https://cos-review.googlesource.com/c/cos/tools/+/36867
Tested-by: He Gao <hegao@google.com>
Cloud-Build: GCB Service account <228075978874@cloudbuild.gserviceaccount.com>
Reviewed-by: Robert Kolchmeyer <rkolchmeyer@google.com>
Reviewed-by: Arnav Kansal <rnv@google.com>
2 files changed
tree: dcb176c9fe3f8a3b0b53b4283828a93cce58fc9a
  1. release/
  2. src/
  3. testing/
  4. .gitignore
  5. BUILD.bazel
  6. cloudbuild.yaml
  7. CONTRIBUTING.md
  8. deps.bzl
  9. go.mod
  10. go.sum
  11. LICENSE
  12. README.md
  13. run_tests.sh
  14. WORKSPACE
README.md

Tools for Container-Optimized OS

This is a repository of various tools developed for Container-Optimized OS. Examples include cos-gpu-installer, cos-toolbox, etc.

See CONTRIBUTING.md for how to contribute.