Add log if resource_filters json does not exist
Currently if resource_filters.json isn't provided there is no error message, but it will limit the actions that regular users can take. Because of this it can be difficult for admins to detect this issue, as this file does not apply to anyone with admin permissions. This patch adds an error message if the file for some reason does not exist. This could happen if a step was missed when upgrading Cinder. Change-Id: I576bd786d8da5b14b5e6c0eb7d17182b1b7e0b81
This commit is contained in:
parent
c154355ea4
commit
be9d5f3fa5
|
@ -354,9 +354,17 @@ def get_cluster_host(req, params, cluster_version=None):
|
|||
|
||||
def _initialize_filters():
|
||||
global _FILTERS_COLLECTION
|
||||
if not _FILTERS_COLLECTION:
|
||||
with open(CONF.resource_query_filters_file, 'r') as filters_file:
|
||||
_FILTERS_COLLECTION = json.load(filters_file)
|
||||
if _FILTERS_COLLECTION:
|
||||
return
|
||||
|
||||
if not os.path.exists(CONF.resource_query_filters_file):
|
||||
LOG.error(
|
||||
"resource query filters file does not exist: %s",
|
||||
CONF.resource_query_filters_file)
|
||||
return
|
||||
|
||||
with open(CONF.resource_query_filters_file, 'r') as filters_file:
|
||||
_FILTERS_COLLECTION = json.load(filters_file)
|
||||
|
||||
|
||||
def get_enabled_resource_filters(resource=None):
|
||||
|
|
Loading…
Reference in New Issue