Browse Source

AMBARI-341. Batch yum commands (Contributed by Ramya)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/ambari-186@1346605 13f79535-47bb-0310-9956-ffa450edef68
Vikram Dixit K 13 năm trước cách đây
mục cha
commit
f790ffaf89

+ 2 - 0
CHANGES.txt

@@ -6,6 +6,8 @@ characters wide.
 
 Release 0.1.x - unreleased
 
+  AMBARI-341. Batch yum commands (Ramya via Vikram)
+
   AMBARI-338. Cluster status update needs to happen for all stages of installation wizard. (Vikram)
 
   AMBARI-330. Provide a way to resume if browser crashes/is closed during the deploy-in-progress (Varun via Vikram)

+ 32 - 8
hmc/puppet/modules/hdp/manifests/init.pp

@@ -1,4 +1,7 @@
-class hdp()
+class hdp(
+  $service_state = undef,
+  $pre_installed_pkgs = undef
+)
 {
   import 'params.pp'
   include hdp::params
@@ -12,22 +15,30 @@ class hdp()
     gid => $hdp::params::hadoop_user_group
   }
   Group[$hdp::params::hadoop_user_group] -> Hdp::User[$hdp::params::hadoop_user] 
-
   class { 'hdp::snmp': service_state => 'running'}
 
   class { 'hdp::create_smoke_user': }
 
+  if ($pre_installed_pkgs != undef) {
+    class { 'hdp::pre_install_pkgs': }
+  }
+
   #turns off selinux
   class { 'hdp::set_selinux': }
 
-  if ($hdp::params::lzo_enabled == true) {
-    @hdp::lzo::package{ 32:}
-    @hdp::lzo::package{ 64:}
-    hdp::artifact_dir { 'hdp::lzo::package::tar':}
+  if ($service_state != 'uninstalled') {
+    if ($hdp::params::lzo_enabled == true) {
+      @hdp::lzo::package{ 32:}
+      @hdp::lzo::package{ 64:}
+      hdp::artifact_dir { 'hdp::lzo::package::tar':}
+    }
   }
+
   #TODO: treat consistently 
-  if ($hdp::params::snappy_enabled == true) {
-    include hdp::snappy::package
+  if ($service_state != 'uninstalled') {
+    if ($hdp::params::snappy_enabled == true) {
+      include hdp::snappy::package
+    }
   }
 
   Hdp::Package<|title == 'hadoop 32'|> ->   Hdp::Package<|title == 'hbase'|>
@@ -40,6 +51,19 @@ class hdp()
 
 }
 
+class hdp::pre_install_pkgs
+{
+  if ($service_state == 'installed_and_configured') {
+    hdp::exec{ 'yum install $pre_installed_pkgs':
+       command => "yum install -y $pre_installed_pkgs"
+    }
+  } elsif ($service_state == 'uninstalled') {
+    hdp::exec{ 'yum erase $pre_installed_pkgs':
+       command => "yum erase -y $pre_installed_pkgs"
+    }
+  }
+}
+
 class hdp::create_smoke_user()
 {
   $smoke_group = $hdp::params::smoke_user_group

+ 1 - 0
hmc/puppet/modules/hdp/manifests/snappy/package.pp

@@ -25,6 +25,7 @@ define hdp::snappy::package::ln()
     $ln_cmd = "mkdir -p $so_target_dir; ln -sf ${so_src} ${so_target}"
     hdp::exec{ "hdp::snappy::package::ln ${name}":
       command => $ln_cmd,
+      unless  => "test -f ${so_target}",
       creates => $so_target
     }
   }