Merge "Fix problem with loading Ambari configs"
This commit is contained in:
commit
d20cc12fea
@ -24,9 +24,9 @@ from sahara.swift import swift_helper
|
|||||||
from sahara.utils import files
|
from sahara.utils import files
|
||||||
|
|
||||||
|
|
||||||
configs = {}
|
CONFIGS = {}
|
||||||
obj_configs = {}
|
OBJ_CONFIGS = {}
|
||||||
cfg_process_map = {
|
CFG_PROCESS_MAP = {
|
||||||
"admin-properties": common.RANGER_SERVICE,
|
"admin-properties": common.RANGER_SERVICE,
|
||||||
"ams-env": common.AMBARI_SERVICE,
|
"ams-env": common.AMBARI_SERVICE,
|
||||||
"ams-hbase-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):
|
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):
|
def _get_config_group(group, param, plugin_version):
|
||||||
for section, process in six.iteritems(cfg_process_map):
|
if not CONFIGS or plugin_version not in CONFIGS:
|
||||||
if process == group and param in configs[plugin_version][section]:
|
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
|
return section
|
||||||
|
|
||||||
|
|
||||||
@ -121,18 +123,18 @@ def _get_param_scope(param):
|
|||||||
|
|
||||||
|
|
||||||
def load_configs(version):
|
def load_configs(version):
|
||||||
if obj_configs.get(version):
|
if OBJ_CONFIGS.get(version):
|
||||||
return obj_configs[version]
|
return OBJ_CONFIGS[version]
|
||||||
cfg_path = "plugins/ambari/resources/configs-%s.json" % version
|
cfg_path = "plugins/ambari/resources/configs-%s.json" % version
|
||||||
vanilla_cfg = jsonutils.loads(files.get_file_text(cfg_path))
|
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]
|
sahara_cfg = [hdp_repo_cfg, hdp_utils_repo_cfg]
|
||||||
for service, confs in vanilla_cfg.items():
|
for service, confs in vanilla_cfg.items():
|
||||||
for k, v in confs.items():
|
for k, v in confs.items():
|
||||||
sahara_cfg.append(provisioning.Config(
|
sahara_cfg.append(provisioning.Config(
|
||||||
k, _get_service_name(service), _get_param_scope(k),
|
k, _get_service_name(service), _get_param_scope(k),
|
||||||
default_value=v))
|
default_value=v))
|
||||||
obj_configs[version] = sahara_cfg
|
OBJ_CONFIGS[version] = sahara_cfg
|
||||||
return sahara_cfg
|
return sahara_cfg
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user