Merge "Disable base repos by the option"
This commit is contained in:
commit
b2602c5a3b
@ -97,6 +97,9 @@ ng_confs = [
|
||||
]
|
||||
|
||||
|
||||
use_base_repos_cfg = provisioning.Config(
|
||||
"Enable external repos on instances", 'general', 'cluster', priority=1,
|
||||
default_value=True, config_type="bool")
|
||||
hdp_repo_cfg = provisioning.Config(
|
||||
"HDP repo URL", "general", "cluster", priority=1, default_value="")
|
||||
hdp_utils_repo_cfg = provisioning.Config(
|
||||
@ -128,7 +131,7 @@ def load_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
|
||||
sahara_cfg = [hdp_repo_cfg, hdp_utils_repo_cfg]
|
||||
sahara_cfg = [hdp_repo_cfg, hdp_utils_repo_cfg, use_base_repos_cfg]
|
||||
for service, confs in vanilla_cfg.items():
|
||||
for k, v in confs.items():
|
||||
sahara_cfg.append(provisioning.Config(
|
||||
@ -143,6 +146,10 @@ def _get_config_value(cluster, key):
|
||||
key.default_value)
|
||||
|
||||
|
||||
def use_base_repos_needed(cluster):
|
||||
return _get_config_value(cluster, use_base_repos_cfg)
|
||||
|
||||
|
||||
def get_hdp_repo_url(cluster):
|
||||
return _get_config_value(cluster, hdp_repo_cfg)
|
||||
|
||||
|
@ -74,6 +74,28 @@ def setup_agents(cluster):
|
||||
LOG.debug("Ambari agents has been installed")
|
||||
|
||||
|
||||
def _disable_repos_on_inst(instance):
|
||||
with context.set_current_instance_id(instance_id=instance.instance_id):
|
||||
with instance.remote() as r:
|
||||
tmp_name = "/tmp/yum.repos.d-%s" % instance.instance_id[:8]
|
||||
sudo = functools.partial(r.execute_command, run_as_root=True)
|
||||
# moving to other folder
|
||||
sudo("mv /etc/yum.repos.d/ {fold_name}".format(
|
||||
fold_name=tmp_name))
|
||||
sudo("mkdir /etc/yum.repos.d")
|
||||
|
||||
|
||||
def disable_repos(cluster):
|
||||
if configs.use_base_repos_needed(cluster):
|
||||
LOG.debug("Using base repos")
|
||||
return
|
||||
instances = plugin_utils.get_instances(cluster)
|
||||
with context.ThreadGroup() as tg:
|
||||
for inst in instances:
|
||||
tg.spawn("disable-repos-%s" % inst.instance_name,
|
||||
_disable_repos_on_inst, inst)
|
||||
|
||||
|
||||
def _setup_agent(instance, ambari_address):
|
||||
with instance.remote() as r:
|
||||
sudo = functools.partial(r.execute_command, run_as_root=True)
|
||||
|
@ -73,6 +73,7 @@ class AmbariPluginProvider(p.ProvisioningPluginBase):
|
||||
return configs.load_configs(hadoop_version)
|
||||
|
||||
def configure_cluster(self, cluster):
|
||||
deploy.disable_repos(cluster)
|
||||
deploy.setup_ambari(cluster)
|
||||
deploy.setup_agents(cluster)
|
||||
deploy.wait_ambari_accessible(cluster)
|
||||
|
Loading…
Reference in New Issue
Block a user