Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #213 from tmatilai/debian-ca-certificates
Browse files Browse the repository at this point in the history
Make sure "ca-certificates" package is installed on Debian
  • Loading branch information
tmatilai committed Feb 28, 2013
2 parents 0b5c88a + f4898af commit 2be1d6b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 67 deletions.
18 changes: 0 additions & 18 deletions lib/knife-solo/bootstraps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,6 @@ def omnibus_options
options
end

def yum_omnibus_install
omnibus_install
# Avoid rsync not being found in package cache.
run_command("sudo yum clean all")
# Make sure we have rsync on builds that don't include it by default
# (for example Scientific Linux minimal, CentOS minimal)
run_command("sudo yum -y install rsync")
end

def debianoid_omnibus_install
omnibus_install
# Update to avoid out-of-date package caches
run_command("sudo apt-get update")
# Make sure we have rsync on builds that don't include it by default
# (for example linode's ubuntu 10.04 images)
run_command("sudo apt-get -y install rsync")
end

def gem_install
ui.msg "Installing rubygems from source..."
release = "rubygems-1.8.10"
Expand Down
82 changes: 35 additions & 47 deletions lib/knife-solo/bootstraps/linux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ def x86?
%w{i686 x86 x86_64}.include?(machine)
end

def lsb_release_codename
run_command("lsb_release -cs").stdout.strip
end

def package_list
@packages.join(' ')
end
Expand All @@ -28,32 +24,7 @@ def emerge_gem_install
gem_install
end

def add_yum_repos(repo_path)
repo_url = "http://rbel.co/"

tmp_file = "/tmp/rbel"
installed = "is already installed"
run_command("sudo yum -y install curl")
run_command("curl #{repo_url}#{repo_path} -o #{tmp_file}")
result = run_command("sudo rpm -Uvh #{tmp_file} && rm #{tmp_file}")
raise result.stderr_or_stdout unless result.success? || result.stdout.match(installed)
end

def yum_install
ui.msg("Installing required packages...")

if distro[:version] == "RHEL5"
repo_path = "rbel5"
else
repo_path = "rbel6"
end

add_yum_repos(repo_path)
@packages = %w(rubygem-chef rsync)
run_command("sudo yum -y --disablerepo=* --enablerepo=#{repo_path} install #{package_list}")
end

def debian_gem_install
def debianoid_gem_install
ui.msg "Updating apt caches..."
run_command("sudo apt-get update")

Expand All @@ -67,43 +38,60 @@ def debian_gem_install
gem_install
end

def debianoid_omnibus_install
# Update to avoid out-of-date package caches
run_command("sudo apt-get update")
# Install packages that are not included on all minimal builds
run_command("sudo apt-get -y install rsync ca-certificates")
omnibus_install
end

def yum_omnibus_install
omnibus_install
# Avoid rsync not being found in package cache.
run_command("sudo yum clean all")
# Make sure we have rsync on builds that don't include it by default
# (for example Scientific Linux minimal, CentOS minimal)
run_command("sudo yum -y install rsync")
end

def distro
return @distro if @distro
@distro = case issue
when %r{Debian GNU/Linux 6}
{:type => (x86? ? "debianoid_omnibus" : "debian_gem"), :version => "squeeze"}
{:type => (x86? ? "debianoid_omnibus" : "debianoid_gem")}
when %r{Debian}
{:type => "debian_gem", :version => lsb_release_codename}
{:type => "debianoid_gem"}
when %r{Ubuntu}i
{:type => (x86? ? "debianoid_omnibus" : "debian_gem"), :version => lsb_release_codename}
{:type => (x86? ? "debianoid_omnibus" : "debianoid_gem")}
when %r{Linaro}
{:type => "debian_gem", :version => lsb_release_codename}
{:type => "debianoid_gem"}
when %r{CentOS.*? 5}
{:type => "yum_omnibus", :version => "RHEL5"}
{:type => "yum_omnibus"}
when %r{CentOS.*? 6}
{:type => "yum_omnibus", :version => "RHEL6"}
{:type => "yum_omnibus"}
when %r{Amazon Linux}
{:type => "yum_omnibus", :version => "RHEL6"}
{:type => "yum_omnibus"}
when %r{Red Hat Enterprise.*? 5}
{:type => "yum_omnibus", :version => "RHEL5"}
{:type => "yum_omnibus"}
when %r{Red Hat Enterprise.*? 6}
{:type => "yum_omnibus", :version => "RHEL6"}
{:type => "yum_omnibus"}
when %r{Fedora release.*? 15}
{:type => "yum_omnibus", :version => "FC15"}
{:type => "yum_omnibus"}
when %r{Fedora release.*? 16}
{:type => "yum_omnibus", :version => "FC16"}
{:type => "yum_omnibus"}
when %r{Fedora release.*? 17}
{:type => "yum_omnibus", :version => "FC17"}
{:type => "yum_omnibus"}
when %r{Scientific Linux.*? 5}
{:type => "yum_omnibus", :version => "RHEL5"}
{:type => "yum_omnibus"}
when %r{Scientific Linux.*? 6}
{:type => "yum_omnibus", :version => "RHEL6"}
{:type => "yum_omnibus"}
when %r{SUSE Linux Enterprise Server 1[12]}
{:type => "omnibus", :version => "SLES11"}
{:type => "omnibus"}
when %r{openSUSE 1[12]}
{:type => "omnibus", :version => "openSUSE"}
{:type => "omnibus"}
when %r{This is \\n\.\\O \(\\s \\m \\r\) \\t}
{:type => "emerge_gem", :version => "Gentoo"}
{:type => "emerge_gem"}
else
raise "Distro not recognized from looking at /etc/issue. Please fork https://github.com/matschaffer/knife-solo and add support for your distro."
end
Expand Down
5 changes: 4 additions & 1 deletion test/bootstraps_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ class KnifeSolo::Bootstraps::StubOS < KnifeSolo::Bootstraps::Base
end

class KnifeSolo::Bootstraps::StubOS2 < KnifeSolo::Bootstraps::Base
def distro ; {:type => 'gem', :version => 'Fanny Faker'} ; end
def distro
{:type => 'gem'}
end

def gem_install
# dont' actually install anything
end
Expand Down
2 changes: 1 addition & 1 deletion test/integration/debian6_bootstrap_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def user
end

def image_id
"ami-4d20a724"
"ami-7ce17315"
end

def prepare_server
Expand Down

0 comments on commit 2be1d6b

Please sign in to comment.