Merge "Fix check_service_setting() logic"

This commit is contained in:
Zuul 2024-05-16 17:10:57 +00:00 committed by Gerrit Code Review
commit 7e9f7ae2e2

View File

@ -394,17 +394,23 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
else: else:
service_prefix = "" service_prefix = ""
cmd_prefix = "crudini --get" cmd_prefix = "crudini --get"
for config_file in config_files: # If we have config file with defaults and second one with overrides,
# the latter has the config that wins
for config_file in reversed(config_files):
setting = "{} {} {}".format(config_file, section, param) setting = "{} {} {}".format(config_file, section, param)
cmd = "{} {} {} || true".format( cmd = "{} {} {} || true".format(
service_prefix, cmd_prefix, setting) service_prefix, cmd_prefix, setting)
LOG.debug("Command = '{}'".format(cmd)) LOG.debug("Command = '{}'".format(cmd))
result = host['client'].exec_command(cmd) result = host['client'].exec_command(cmd).strip()
LOG.debug("Result = '{}'".format(result)) LOG.debug("Result = '{}'".format(result))
# Since we are checking files in reverse order,
# if we've found a value than it's an override and we
# should ignore values in other files
if result:
if value.lower() in result.lower(): if value.lower() in result.lower():
return True return True
else: else:
continue break
if skip_if_fails: if skip_if_fails:
raise cls.skipException(msg) raise cls.skipException(msg)