Merge "Fix problem with loading Ambari configs"

This commit is contained in:
Jenkins 2015-09-24 20:30:46 +00:00 committed by Gerrit Code Review
commit d20cc12fea
1 changed files with 12 additions and 10 deletions

View File

@ -24,9 +24,9 @@ from sahara.swift import swift_helper
from sahara.utils import files
configs = {}
obj_configs = {}
cfg_process_map = {
CONFIGS = {}
OBJ_CONFIGS = {}
CFG_PROCESS_MAP = {
"admin-properties": common.RANGER_SERVICE,
"ams-env": common.AMBARI_SERVICE,
"ams-hbase-env": common.AMBARI_SERVICE,
@ -104,12 +104,14 @@ hdp_utils_repo_cfg = provisioning.Config(
def _get_service_name(service):
return cfg_process_map.get(service, service)
return CFG_PROCESS_MAP.get(service, service)
def _get_config_group(group, param, plugin_version):
for section, process in six.iteritems(cfg_process_map):
if process == group and param in configs[plugin_version][section]:
if not CONFIGS or plugin_version not in CONFIGS:
load_configs(plugin_version)
for section, process in six.iteritems(CFG_PROCESS_MAP):
if process == group and param in CONFIGS[plugin_version][section]:
return section
@ -121,18 +123,18 @@ def _get_param_scope(param):
def load_configs(version):
if obj_configs.get(version):
return obj_configs[version]
if OBJ_CONFIGS.get(version):
return OBJ_CONFIGS[version]
cfg_path = "plugins/ambari/resources/configs-%s.json" % version
vanilla_cfg = jsonutils.loads(files.get_file_text(cfg_path))
configs[version] = vanilla_cfg
CONFIGS[version] = vanilla_cfg
sahara_cfg = [hdp_repo_cfg, hdp_utils_repo_cfg]
for service, confs in vanilla_cfg.items():
for k, v in confs.items():
sahara_cfg.append(provisioning.Config(
k, _get_service_name(service), _get_param_scope(k),
default_value=v))
obj_configs[version] = sahara_cfg
OBJ_CONFIGS[version] = sahara_cfg
return sahara_cfg