Fix RequiredOptError when missing lock_path

When lock_file is not present on the [oslo_concurrency] section of the
config file, we are getting a misleading error saying that it is not
preset on the DEFAULT group. This commit fixes it by providing the group
arg to the RequiredOptError constructor.

Closes-Bug: #1966320

Signed-off-by: Thiago Brito <thiago.brito@windriver.com>
Change-Id: Idee6987739917c7eae4faee15a66085a9ef7f6d2
This commit is contained in:
Thiago Brito 2022-03-24 15:11:57 -03:00
parent 51a43dacc4
commit 11210a957c
1 changed files with 1 additions and 1 deletions

View File

@ -180,7 +180,7 @@ def _get_lock_path(name, lock_file_prefix, lock_path=None):
local_lock_path = lock_path or CONF.oslo_concurrency.lock_path
if not local_lock_path:
raise cfg.RequiredOptError('lock_path')
raise cfg.RequiredOptError('lock_path', 'oslo_concurrency')
return os.path.join(local_lock_path, name)