cookbooks/mu-master/recipes/init.rb in cloud-mu-2.0.4 vs cookbooks/mu-master/recipes/init.rb in cloud-mu-2.1.0beta

- old
+ new

@@ -171,11 +171,11 @@ rpms = {} dpkgs = {} elversion = node['platform_version'].to_i > 2000 ? 6 : node['platform_version'].to_i if platform_family?("rhel") - basepackages = ["git", "curl", "diffutils", "patch", "gcc", "gcc-c++", "make", "postgresql-devel", "libyaml", "libffi-devel"] + basepackages = ["git", "curl", "diffutils", "patch", "gcc", "gcc-c++", "make", "postgresql-devel", "libyaml", "libffi-devel", "tcl", "tk"] # package epel-release-6-8.9.amzn1.noarch (which is newer than epel-release-6-8.noarch) is already installed rpms = { "epel-release" => "http://dl.fedoraproject.org/pub/epel/epel-release-latest-#{elversion}.noarch.rpm", "chef-server-core" => "https://packages.chef.io/files/stable/chef-server/#{CHEF_SERVER_VERSION.sub(/\-\d+$/, "")}/el/#{elversion}/chef-server-core-#{CHEF_SERVER_VERSION}.el#{elversion}.x86_64.rpm" @@ -187,17 +187,19 @@ # RHEL6, CentOS6, Amazon Linux elsif elversion < 7 basepackages.concat(["mysql-devel"]) rpms["ruby25"] = "https://s3.amazonaws.com/cloudamatic/muby-2.5.3-1.el6.x86_64.rpm" + rpms["python27"] = "https://s3.amazonaws.com/cloudamatic/muthon-2.7.16-1.el6.x86_64.rpm" removepackages = ["nagios"] # RHEL7, CentOS7 elsif elversion < 8 - basepackages.concat(["libX11", "tcl", "tk", "mariadb-devel", "cryptsetup"]) + basepackages.concat(["libX11", "mariadb-devel", "cryptsetup"]) rpms["ruby25"] = "https://s3.amazonaws.com/cloudamatic/muby-2.5.3-1.el7.x86_64.rpm" + rpms["python27"] = "https://s3.amazonaws.com/cloudamatic/muthon-2.7.16-1.el7.x86_64.rpm" removepackages = ["nagios", "firewalld"] end # Amazon Linux if node['platform_version'].to_i > 2000 basepackages.concat(["compat-libffi5"]) @@ -282,24 +284,23 @@ end # REMOVE OLD RUBYs execute "clean up old Ruby 2.1.6" do command "rm -rf /opt/rubies/ruby-2.1.6" + ignore_failure true only_if { ::Dir.exist?("/opt/rubies/ruby-2.1.6") } end -yum_package 'ruby23-2.3.1-1.el7.centos.x86_64' do - action :purge -end - execute "Kill ruby-2.3.1" do command "yum erase ruby23-2.3.1-1.el7.centos.x86_64 -y; rpm -e ruby23" + ignore_failure true only_if { ::Dir.exist?("/opt/rubies/ruby-2.3.1") } end execute "clean up old ruby-2.3.1" do command "rm -rf /opt/rubies/ruby-2.3.1" + ignore_failure true only_if { ::Dir.exist?("/opt/rubies/ruby-2.3.1") } end # Regular old rpm-based installs rpms.each_pair { |pkg, src| @@ -318,10 +319,11 @@ only_if { RUNNING_STANDALONE } end end end } + package ["jq"] do ignore_failure true # sometimes we can't see EPEL immediately end package removepackages do action :remove @@ -380,10 +382,16 @@ remote_file "#{MU_BASE}/bin/mu-self-update" do source "file://#{MU_BASE}/lib/bin/mu-self-update" mode 0755 end +bash "install modules for our built-in Python" do + code <<-EOH + /usr/local/python-current/bin/pip install -r #{MU_BASE}/lib/requirements.txt + EOH +end + ["/usr/local/ruby-current", "/opt/chef/embedded"].each { |rubydir| gembin = rubydir+"/bin/gem" gemdir = Dir.glob("#{rubydir}/lib/ruby/gems/?.?.?/gems").last bundler_path = gembin.sub(/gem$/, "bundle") bash "fix #{rubydir} gem permissions" do @@ -397,11 +405,10 @@ gem_package bundler_path do gem_binary gembin package_name "bundler" action :upgrade if rubydir == "/usr/local/ruby-current" notifies :run, "bash[fix #{rubydir} gem permissions]", :delayed - options('-q --no-documentation') end execute "#{bundler_path} install" do cwd "#{MU_BASE}/lib/modules" umask 0022 not_if "#{bundler_path} check" @@ -419,11 +426,10 @@ package_name "knife-windows" version Regexp.last_match[1] action :remove only_if { ::Dir.exist?(dir) } only_if { ::Dir.exist?(gemdir) } - options('-q --no-documentation') end execute "rm -rf #{gemdir}/knife-windows-#{Regexp.last_match[1]}" } # XXX rely on bundler to get this right for us @@ -544,10 +550,10 @@ end file "#{MU_BASE}/etc/mu.rc" do content %Q{export MU_INSTALLDIR="#{MU_BASE}" export MU_DATADIR="#{MU_BASE}/var" -export PATH="#{MU_BASE}/bin:/usr/local/ruby-current/bin:${PATH}:/opt/opscode/embedded/bin" +export PATH="#{MU_BASE}/bin:/usr/local/ruby-current/bin:/usr/local/python-current/bin:${PATH}:/opt/opscode/embedded/bin" } mode 0644 action :create_if_missing not_if { ::File.size?("#{MU_BASE}/etc/mu.rc") } end