diff --git a/apis/chef/src/main/java/org/jclouds/chef/statements/InstallChefGems.java b/apis/chef/src/main/java/org/jclouds/chef/statements/InstallChefGems.java index 802d6f9f8a..11609239ee 100644 --- a/apis/chef/src/main/java/org/jclouds/chef/statements/InstallChefGems.java +++ b/apis/chef/src/main/java/org/jclouds/chef/statements/InstallChefGems.java @@ -19,16 +19,14 @@ package org.jclouds.chef.statements; -import java.io.IOException; -import java.util.Collections; - -import javax.inject.Singleton; - +import com.google.common.base.Throwables; import org.jclouds.scriptbuilder.domain.OsFamily; import org.jclouds.scriptbuilder.domain.Statement; -import org.jclouds.util.Utils; +import org.jclouds.util.Strings2; -import com.google.common.base.Throwables; +import javax.inject.Singleton; +import java.io.IOException; +import java.util.Collections; /** * @author Adrian Cole @@ -38,8 +36,7 @@ public class InstallChefGems implements Statement { @Override public String render(OsFamily family) { try { - return Utils.toStringAndClose(InstallChefGems.class.getClassLoader().getResourceAsStream( - "install-chef-gems.sh")); + return Strings2.toStringAndClose(getClass().getResourceAsStream("install-chef-gems.sh")); } catch (IOException e) { Throwables.propagate(e); return null; diff --git a/apis/chef/src/main/resources/install-chef-gems.sh b/apis/chef/src/main/resources/install-chef-gems.sh deleted file mode 100755 index e68baaa3cd..0000000000 --- a/apis/chef/src/main/resources/install-chef-gems.sh +++ /dev/null @@ -1,15 +0,0 @@ -if [ ! -f /usr/bin/chef-client ]; then - apt-get update - apt-get install -y ruby ruby1.8-dev build-essential wget libruby-extras libruby1.8-extras - mkdir -p /tmp/bootchef - ( - cd /tmp/bootchef - wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz - tar xvf rubygems-1.3.6.tgz - cd rubygems-1.3.6 - ruby setup.rb - cp /usr/bin/gem1.8 /usr/bin/gem - ) - rm -rf /tmp/bootchef - gem install chef ohai --no-rdoc --no-ri --verbose -fi diff --git a/apis/chef/src/main/resources/org/jclouds/chef/statements/install-chef-gems.sh b/apis/chef/src/main/resources/org/jclouds/chef/statements/install-chef-gems.sh new file mode 100755 index 0000000000..98524d477b --- /dev/null +++ b/apis/chef/src/main/resources/org/jclouds/chef/statements/install-chef-gems.sh @@ -0,0 +1,16 @@ +if [ ! -f /usr/bin/chef-client ]; then + apt-get update -o Acquire::http::No-Cache=True + apt-get install -y ruby ruby1.8-dev build-essential wget libruby-extras libruby1.8-extras + # Comment next line for production controlled environments, this should be part of a recipe + apt-get -y upgrade + ( + mkdir -p /tmp/bootchef + cd /tmp/bootchef + wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz + tar zxf rubygems-1.3.7.tgz + cd rubygems-1.3.7 + ruby setup.rb --no-format-executable + rm -fr /tmp/bootchef + ) + /usr/bin/gem install ohai chef --no-rdoc --no-ri --verbose +fi