Flush temp license file content

The license_file may appear empty during the license plugin
verification because the write() operation buffers the data
in memory and does not immediately write it to disk.
Calling flush() explicitly ensures that the content is
written to disk immediately.

Test Plan
PASS: verify the license check passes with no empty file error

Closes-bug: 2093343

Signed-off-by: Fabiano Correa Mercer <fabiano.correamercer@windriver.com>
Change-Id: Ibf5e04b1516ce789812e09a50689ec268cd06e4d
This commit is contained in:
Fabiano Correa Mercer 2024-12-17 17:06:31 -03:00 committed by Heitor Matsui
parent 996dff0313
commit d1e5252e7b

@ -78,6 +78,7 @@ class HealthCheck(object):
with tempfile.NamedTemporaryFile(mode="w", delete=True) as license_file:
try:
license_file.write(license_dict["content"])
license_file.flush()
subprocess.check_call(["/usr/bin/verify-license", # pylint: disable=not-callable
license_file.name,
version],