From b330d50c28af0b5e6abc386d2226a91056906e81 Mon Sep 17 00:00:00 2001 From: Artem Osadchyi Date: Fri, 7 Aug 2015 12:39:30 +0300 Subject: [PATCH] Prevent writing security repos twice in MapR plugin Registration of precise and lucid security repos moved to separate bash script which is executed only in case of non-prebuilt images. Prebuilt images already contains this repos. Change-Id: I9151e1213b0fa75e4c7e8e16839d269d38a3adce Closes-Bug: #1482237 --- sahara/plugins/mapr/base/base_cluster_configurer.py | 8 ++++++++ sahara/plugins/mapr/resources/add_mapr_repo.sh | 4 ---- sahara/plugins/mapr/resources/add_security_repos.sh | 6 ++++++ 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 sahara/plugins/mapr/resources/add_security_repos.sh diff --git a/sahara/plugins/mapr/base/base_cluster_configurer.py b/sahara/plugins/mapr/base/base_cluster_configurer.py index 9d4adccf..c06a8c62 100644 --- a/sahara/plugins/mapr/base/base_cluster_configurer.py +++ b/sahara/plugins/mapr/base/base_cluster_configurer.py @@ -24,6 +24,7 @@ from sahara import context from sahara.i18n import _LI from sahara.i18n import _LW import sahara.plugins.mapr.abstract.configurer as ac +from sahara.plugins.mapr.domain import distro as d import sahara.plugins.mapr.services.management.management as mng import sahara.plugins.mapr.services.mapreduce.mapreduce as mr from sahara.plugins.mapr.services.maprfs import maprfs @@ -48,6 +49,7 @@ INSTALL_JAVA_SCRIPT = 'plugins/mapr/resources/install_java.sh' INSTALL_SCALA_SCRIPT = 'plugins/mapr/resources/install_scala.sh' INSTALL_MYSQL_CLIENT = 'plugins/mapr/resources/install_mysql_client.sh' ADD_MAPR_REPO_SCRIPT = 'plugins/mapr/resources/add_mapr_repo.sh' +ADD_SECURITY_REPO_SCRIPT = 'plugins/mapr/resources/add_security_repos.sh' SERVICE_INSTALL_PRIORITY = [ mng.Management(), @@ -107,6 +109,12 @@ class BaseConfigurer(ac.AbstractConfigurer): def _prepare_bare_image(self, cluster_context, instances): LOG.debug('Preparing bare image') + + if d.UBUNTU == cluster_context.distro: + LOG.debug("Installing security repos") + util.execute_on_instances( + instances, util.run_script, ADD_SECURITY_REPO_SCRIPT, 'root') + d_name = cluster_context.distro.name LOG.debug('Installing Java') diff --git a/sahara/plugins/mapr/resources/add_mapr_repo.sh b/sahara/plugins/mapr/resources/add_mapr_repo.sh index c6686f57..601260a2 100644 --- a/sahara/plugins/mapr/resources/add_mapr_repo.sh +++ b/sahara/plugins/mapr/resources/add_mapr_repo.sh @@ -4,10 +4,6 @@ if [ "$1" = "Ubuntu" ]; then cat >> /etc/apt/sources.list.d/maprtech.list << EOF deb %(ubuntu_mapr_base_repo)s deb %(ubuntu_mapr_ecosystem_repo)s -EOF - cat >> /etc/apt/sources.list.d/security_repo.list << EOF -deb http://security.ubuntu.com/ubuntu precise-security main -deb http://security.ubuntu.com/ubuntu lucid-security main EOF sudo apt-get install -y --force-yes wget wget -O - http://package.mapr.com/releases/pub/maprgpg.key | sudo apt-key add - diff --git a/sahara/plugins/mapr/resources/add_security_repos.sh b/sahara/plugins/mapr/resources/add_security_repos.sh new file mode 100644 index 00000000..78be7812 --- /dev/null +++ b/sahara/plugins/mapr/resources/add_security_repos.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +cat >> /etc/apt/sources.list.d/security_repo.list << EOF +deb http://security.ubuntu.com/ubuntu precise-security main +deb http://security.ubuntu.com/ubuntu lucid-security main +EOF