Fix heat template validation when multi users

Fix that after the first user-related f.read(), the next user will attempt to f.read() at the end of the file, correcting the sending of blank content.

Closes-bug: #2054790
Change-Id: I95d73d3459087c8c18c1ecd5e7d1833268e7ed75
This commit is contained in:
do-gyun 2024-02-23 17:59:57 +09:00
parent 275e639388
commit 2c05430515
2 changed files with 4 additions and 1 deletions

View File

@ -53,6 +53,8 @@ Fixed
* Nova server cleanup fails to list resources due to wrong marker.
* Heat template validation when multi users.
[2.3.0] - 2023-08-01
--------------------

View File

@ -469,9 +469,10 @@ class ValidateHeatTemplateValidator(validation.Validator):
self.fail("No file found by the given path %s" % template_path)
with open(template_path, "r") as f:
try:
template_file = f.read()
for user in context["users"]:
clients = user["credential"].clients()
clients.heat().stacks.validate(template=f.read())
clients.heat().stacks.validate(template=template_file)
except Exception as e:
self.fail("Heat template validation failed on %(path)s. "
"Original error message: %(msg)s." %