External OpenStack action mapping file support added
It was not possible to specify external openstack action mappong files for mistral, but now support for extenal mappings with absolute path is added. Change-Id: Ia4fa15d396e3c1f5ad91cbcf2fa69a75443becf6 Closes-Bug: #1655557
This commit is contained in:
parent
7f0f09f410
commit
5e41fc7f21
@ -13,6 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
@ -29,7 +30,6 @@ os_actions_mapping_path = cfg.StrOpt('openstack_actions_mapping_path',
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opt(os_actions_mapping_path)
|
||||
LOG = logging.getLogger(__name__)
|
||||
MAPPING_PATH = CONF.openstack_actions_mapping_path
|
||||
|
||||
|
||||
def get_mapping():
|
||||
@ -40,7 +40,17 @@ def get_mapping():
|
||||
if '_comment' in map_part:
|
||||
del map_part['_comment']
|
||||
package = version.version_info.package
|
||||
with open(pkg.resource_filename(package, MAPPING_PATH)) as fh:
|
||||
|
||||
if os.path.isabs(CONF.openstack_actions_mapping_path):
|
||||
mapping_file_path = CONF.openstack_actions_mapping_path
|
||||
else:
|
||||
path = CONF.openstack_actions_mapping_path
|
||||
mapping_file_path = pkg.resource_filename(package, path)
|
||||
|
||||
LOG.info("Processing OpenStack action mapping from file: %s",
|
||||
mapping_file_path)
|
||||
|
||||
with open(mapping_file_path) as fh:
|
||||
mapping = json.load(fh)
|
||||
|
||||
for k, v in mapping.items():
|
||||
|
Loading…
Reference in New Issue
Block a user