Author: asavu
Date: Tue Oct 25 10:51:47 2011
New Revision: 1188599

URL: http://svn.apache.org/viewvc?rev=1188599&view=rev
Log:
WHIRR-411. Put install_git, install_ruby scripts in core (Alex Heneveld via 
asavu)

Added:
    whirr/trunk/core/src/main/resources/functions/install_git.sh
    whirr/trunk/core/src/main/resources/functions/install_ruby.sh
Removed:
    whirr/trunk/services/puppet/src/main/resources/functions/install_ruby.sh
Modified:
    whirr/trunk/CHANGES.txt
    
whirr/trunk/services/puppet/src/main/java/org/apache/whirr/service/puppet/PuppetInstallClusterActionHandler.java
    whirr/trunk/services/puppet/src/main/resources/functions/install_puppet.sh

Modified: whirr/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/whirr/trunk/CHANGES.txt?rev=1188599&r1=1188598&r2=1188599&view=diff
==============================================================================
--- whirr/trunk/CHANGES.txt (original)
+++ whirr/trunk/CHANGES.txt Tue Oct 25 10:51:47 2011
@@ -48,6 +48,8 @@ Trunk (unreleased changes)
 
     WHIRR-400. Upgrade to jclouds 1.2.1 (Adrian Cole and asavu)
 
+    WHIRR-411. put install_git, install_ruby scripts in core (Alex Heneveld 
via asavu)
+
   BUG FIXES
 
     WHIRR-377. Fix broken CLI logging config. (asavu via tomwhite)

Added: whirr/trunk/core/src/main/resources/functions/install_git.sh
URL: 
http://svn.apache.org/viewvc/whirr/trunk/core/src/main/resources/functions/install_git.sh?rev=1188599&view=auto
==============================================================================
--- whirr/trunk/core/src/main/resources/functions/install_git.sh (added)
+++ whirr/trunk/core/src/main/resources/functions/install_git.sh Tue Oct 25 
10:51:47 2011
@@ -0,0 +1,46 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+function install_git() {
+  if ! which git &> /dev/null ; then
+    install_git_forced
+  fi
+}
+
+function install_git_forced() {  
+  if which dpkg &> /dev/null; then
+    install_git_deb
+  elif which yum &> /dev/null; then
+    install_git_rpm
+  else
+    echo "WARNING: could not install git, no appropriate package manager"
+  fi
+}
+
+function install_git_rpm() {
+  if [ `uname -m` == 'x86_64' ]; then
+    rpm -Uvh 
http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
+  else
+    rpm -Uvh 
http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
+  fi
+  yum -y install git
+}
+
+function install_git_deb() {
+  apt-get update -qq
+  apt-get -y install git-core
+}

Added: whirr/trunk/core/src/main/resources/functions/install_ruby.sh
URL: 
http://svn.apache.org/viewvc/whirr/trunk/core/src/main/resources/functions/install_ruby.sh?rev=1188599&view=auto
==============================================================================
--- whirr/trunk/core/src/main/resources/functions/install_ruby.sh (added)
+++ whirr/trunk/core/src/main/resources/functions/install_ruby.sh Tue Oct 25 
10:51:47 2011
@@ -0,0 +1,50 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+function install_ruby() {
+  if ! which ruby &> /dev/null; then
+    if which dpkg &> /dev/null; then
+      install_ruby_deb
+      add_to_path
+    elif which yum &> /dev/null; then
+      install_ruby_rpm
+      add_to_path
+    else
+      echo "ERROR: could not install ruby, no appropriate package manager" 
+      return 1
+    fi
+  fi
+}
+
+function install_ruby_rpm() {
+  if [ `uname -m` == 'x86_64' ]; then
+    rpm -Uvh 
http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
+  else
+    rpm -Uvh 
http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
+  fi
+  yum -y install ruby ruby-rdoc rubygems
+}
+
+function install_ruby_deb() {
+  apt-get install -y ruby ruby-dev rubygems libopenssl-ruby rdoc ri irb 
build-essential wget ssl-cert
+}
+
+function add_to_path() {
+  # add the gems executable directory to the path
+  echo "export PATH=$PATH:"`gem environment | grep "EXECUTABLE DIRECTORY" | 
sed 's|- EXECUTABLE DIRECTORY: ||' | sed -e 's/^[ \t]*//'`"" >> /etc/profile
+  echo "export PATH=$PATH:"`gem environment | grep "EXECUTABLE DIRECTORY" | 
sed 's|- EXECUTABLE DIRECTORY: ||' | sed -e 's/^[ \t]*//'`"" >> /etc/bash.bashrc
+}

Modified: 
whirr/trunk/services/puppet/src/main/java/org/apache/whirr/service/puppet/PuppetInstallClusterActionHandler.java
URL: 
http://svn.apache.org/viewvc/whirr/trunk/services/puppet/src/main/java/org/apache/whirr/service/puppet/PuppetInstallClusterActionHandler.java?rev=1188599&r1=1188598&r2=1188599&view=diff
==============================================================================
--- 
whirr/trunk/services/puppet/src/main/java/org/apache/whirr/service/puppet/PuppetInstallClusterActionHandler.java
 (original)
+++ 
whirr/trunk/services/puppet/src/main/java/org/apache/whirr/service/puppet/PuppetInstallClusterActionHandler.java
 Tue Oct 25 10:51:47 2011
@@ -45,9 +45,11 @@ public class PuppetInstallClusterActionH
     InterruptedException {
    
    // install ruby and ruby-gems in the nodes
-   // (NB script is same as that in whirr-chef patch, WHIRR-49)
    addStatement(event, call("install_ruby"));
 
+   // install git
+   addStatement(event, call("install_git"));
+
    // install puppet
    addStatement(event, call("install_puppet"));
   }

Modified: 
whirr/trunk/services/puppet/src/main/resources/functions/install_puppet.sh
URL: 
http://svn.apache.org/viewvc/whirr/trunk/services/puppet/src/main/resources/functions/install_puppet.sh?rev=1188599&r1=1188598&r2=1188599&view=diff
==============================================================================
--- whirr/trunk/services/puppet/src/main/resources/functions/install_puppet.sh 
(original)
+++ whirr/trunk/services/puppet/src/main/resources/functions/install_puppet.sh 
Tue Oct 25 10:51:47 2011
@@ -16,52 +16,24 @@
 #
 
 function install_puppet() {
-       if ! which git &> /dev/null ; then
-               install_git_forced
-       fi
-       if ! which puppet &> /dev/null ; then
-               install_puppet_forced
-       fi
-}
-
-function install_git_forced() {        
-       if which dpkg &> /dev/null; then
-       install_git_deb
-       elif which yum &> /dev/null; then
-       install_git_rpm
-    else
-       echo "WARNING: could not install git, no appropriate package manager"
-       fi
-}
-
-function install_git_rpm() {
-       if [ `uname -m` == 'x86_64' ]; then
-        rpm -Uvh 
http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
-    else
-        rpm -Uvh 
http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
-    fi
-    yum -y install git
-}
-
-function install_git_deb() {
-    apt-get update -qq
-    apt-get -y install git-core
+  if ! which puppet &> /dev/null ; then
+    install_puppet_forced
+  fi
 }
 
 function install_puppet_forced() {
-       # this script assumes ruby and ruby gems are already installed
-       
-       # Setup the default module/fact path locations so we can populate them
-       # elsewhere
-       mkdir -p /etc/puppet/modules
-       mkdir -p /etc/puppet/manifests
-       mkdir -p /usr/share/puppet/modules
-       mkdir -p /var/lib/puppet/lib/facter
-
-       # install the puppet and facter gems
-       sudo gem install facter --no-rdoc --no-ri --bindir /usr/bin/
-       sudo gem install puppet --no-rdoc --no-ri --bindir /usr/bin/
-       
-       sudo useradd puppet
-               
+  # this script assumes ruby and ruby gems are already installed
+ 
+  # Setup the default module/fact path locations so we can populate them
+  # elsewhere
+  mkdir -p /etc/puppet/modules
+  mkdir -p /etc/puppet/manifests
+  mkdir -p /usr/share/puppet/modules
+  mkdir -p /var/lib/puppet/lib/facter
+
+  # install the puppet and facter gems
+  sudo gem install facter --no-rdoc --no-ri --bindir /usr/bin/
+  sudo gem install puppet --no-rdoc --no-ri --bindir /usr/bin/
+ 
+  sudo useradd puppet
 }


Reply via email to