Fix chef cookbooks to work with ubuntu 14.04

The primary issue was that libshadow-ruby1.8 is not
present in 14.04. The secondary one is that default
ruby in 14.04 is 1.9, so update-alternatives step
fails.

Fix:
* drop the requirement of libshadow-ruby1.8, since
we set 1.9 by default.
* see if 'ruby' points to 1.9 and update symlinks only
in case it doesn't

Konstantin Nazarov лет %!s(int64=10): %!d(string=назад)
Родитель
Сommit
3413e92df7

+ 11 - 4
deployment/site-cookbooks/huginn_development/recipes/default.rb

@@ -16,16 +16,23 @@ group "huginn" do
16 16
   action :create
17 17
 end
18 18
 
19
-%w("ruby1.9.1" "ruby1.9.1-dev" "libxslt-dev" "libxml2-dev" "curl" "libmysqlclient-dev" "rubygems").each do |pkg|
19
+%w("ruby1.9.1" "ruby1.9.1-dev" "libxslt-dev" "libxml2-dev" "curl" "libmysqlclient-dev" "libffi-dev" "libssl-dev").each do |pkg|
20 20
   package pkg do
21 21
     action :install
22 22
   end
23 23
 end
24 24
 
25
-bash "Setting default ruby version to 1.9" do
25
+bash "Setting default ruby and gem versions to 1.9" do
26 26
   code <<-EOH
27
-    update-alternatives --set ruby /usr/bin/ruby1.9.1
28
-    update-alternatives --set gem /usr/bin/gem1.9.1
27
+    if [ $(readlink /usr/bin/ruby) != "ruby1.9.1" ]
28
+    then
29
+      update-alternatives --set ruby /usr/bin/ruby1.9.1
30
+    fi
31
+
32
+    if [ $(readlink /usr/bin/gem) != "gem1.9.1" ]
33
+    then
34
+      update-alternatives --set gem /usr/bin/gem1.9.1
35
+    fi
29 36
   EOH
30 37
 end
31 38
 

+ 11 - 4
deployment/site-cookbooks/huginn_production/recipes/default.rb

@@ -14,14 +14,21 @@ group "huginn" do
14 14
   members ["huginn"]
15 15
 end
16 16
 
17
-%w("ruby1.9.1" "ruby1.9.1-dev" "libxslt-dev" "libxml2-dev" "curl" "libshadow-ruby1.8" "libmysqlclient-dev" "libffi-dev" "libssl-dev" "rubygems").each do |pkg|
17
+%w("ruby1.9.1" "ruby1.9.1-dev" "libxslt-dev" "libxml2-dev" "curl" "libmysqlclient-dev" "libffi-dev" "libssl-dev").each do |pkg|
18 18
   package("#{pkg}")
19 19
 end
20 20
 
21
-bash "Setting default ruby version to 1.9" do
21
+bash "Setting default ruby and gem versions to 1.9" do
22 22
   code <<-EOH
23
-    update-alternatives --set ruby /usr/bin/ruby1.9.1
24
-    update-alternatives --set gem /usr/bin/gem1.9.1
23
+    if [ $(readlink /usr/bin/ruby) != "ruby1.9.1" ]
24
+    then
25
+      update-alternatives --set ruby /usr/bin/ruby1.9.1
26
+    fi
27
+
28
+    if [ $(readlink /usr/bin/gem) != "gem1.9.1" ]
29
+    then
30
+      update-alternatives --set gem /usr/bin/gem1.9.1
31
+    fi
25 32
   EOH
26 33
 end
27 34