lib/poolparty/base_packages/poolparty.rb in auser-poolparty-0.2.26 vs lib/poolparty/base_packages/poolparty.rb in auser-poolparty-0.2.35

- old
+ new

@@ -1,48 +1,33 @@ module PoolParty class Base plugin :poolparty do - def enable - # These are all requirements on the master - execute_if("$hostname", "master") do - has_cron({:name => "maintain script ", :command => ". /etc/profile && which cloud-maintain | /bin/sh", :minute => "*/3"}) - # TODO: Update this so it only runs when needed - has_exec(:name => ". /etc/profile && server-start-master") - # has_exec(:name => "download-activesupport", :cwd => Base.remote_storage_path) do - # command "wget http://rubyforge.org/frs/download.php/45627/activesupport-2.1.2.gem -O activesupport.gem" - # end - # has_exec(:name => "download-ParseTree", :cwd => Base.remote_storage_path) do - # command "wget http://rubyforge.org/frs/download.php/45600/ParseTree-3.0.1.gem -O ParseTree.gem" - # end - # has_exec(:name => "download-RubyInline", :cwd => Base.remote_storage_path) do - # command "wget http://rubyforge.org/frs/download.php/45683/RubyInline-3.8.1.gem -O RubyInline.gem" - # end - end - + def enable has_package(:name => "erlang") has_package(:name => "erlang-dev") has_package(:name => "erlang-src") has_package(:name => "rubygems") do |g| # These should be installed automagically by poolparty, but just in case # TODO: Fix the requires method with a helper g.has_gempackage(:name => "logging", :download_url => "http://rubyforge.org/frs/download.php/44731/logging-0.9.4.gem") + g.has_gempackage(:name => "hoe", :download_url => "http://rubyforge.org/frs/download.php/45685/hoe-1.8.2.gem") + g.has_gempackage(:name => "rake", :download_url => "http://rubyforge.org/frs/download.php/43954/rake-0.8.3.gem") g.has_gempackage(:name => "xml-simple") do |x| - x.has_gempackage(:name => "grempe-amazon-ec2", :source => "http://gems.github.com") + x.has_gempackage(:name => "grempe-amazon-ec2", :download_url => "http://rubyforge.org/frs/download.php/43666/amazon-ec2-0.3.1.gem") end has_gempackage(:name => "ParseTree", :download_url => "http://rubyforge.org/frs/download.php/45600/ParseTree-3.0.1.gem") do |pt| pt.has_gempackage(:name => "ruby2ruby", :download_url => "http://rubyforge.org/frs/download.php/45587/ruby2ruby-1.2.0.gem") pt.has_gempackage(:name => "activesupport", :download_url => "http://rubyforge.org/frs/download.php/45627/activesupport-2.1.2.gem") do |a| - a.has_gempackage(:name => "auser-poolparty", :source => "http://gems.github.com") do |pool| - pool.has_exec(:name => "build_messenger", :command => ". /etc/profile && server-build-messenger", :requires => get_gempackage("auser-poolparty")) do |mess| - mess.has_exec(:name => "start_node", :command => ". /etc/profile && server-start-node") - end - end + a.has_gempackage(:name => "poolparty", :download_url => "http://github.com/auser/poolparty/tree/master%2Fpkg%2Fpoolparty-latest.gem?raw=true") end has_gempackage(:name => "RubyInline", :download_url => "http://rubyforge.org/frs/download.php/45683/RubyInline-3.8.1.gem") + + has_exec(:name => "build_messenger", :command => ". /etc/profile && server-build-messenger", :requires => get_gempackage("poolparty")) + has_exec(:name => "start_node", :command => ". /etc/profile && server-start-node", :requires => get_exec("build_messenger")) end end # Build hostsfile @@ -51,32 +36,26 @@ has_host({:name => "#{ri.name}", :ip => ri.ip }) end # Custom run puppet to minimize footprint # TODO: Update the offsetted times - has_cron(:name => "puppetd runner", :user => Base.user, :minute => [0,15,30,45]) do + has_cron(:name => "puppetd runner", :user => Base.user, :minute => "*/8") do command((self.respond_to?(:master) ? self : parent).master.puppet_runner_command) end - # has_host(:name => "puppet", :ip => (self.respond_to?(:master) ? self : parent).master.ip) - custom_function <<-EOE -define download_file( - $site="", - $cwd="", - $creates="", - $require="", - $user="") { - - exec { $name: - command => "wget ${site}/${name}", - cwd => $cwd, - creates => "${cwd}/${name}", - require => $require, - user => $user, - } - -} - EOE + # These are all requirements on the master + execute_if("$hostname", "master") do + has_cron({:name => "maintain script ", :command => ". /etc/profile && which cloud-maintain | /bin/sh", :minute => "*/3"}) + # TODO: Update this so it only runs when needed + has_exec(:name => "start master messenger", :command => ". /etc/profile && server-start-master", :requires => [get_gempackage("poolparty"), get_exec("build_messenger")]) + + has_remotefile(:name => "/usr/bin/puppetcleaner") do + mode 744 + template File.join(File.dirname(__FILE__), "..", "templates/puppetcleaner") + end + end + + # has_host(:name => "puppet", :ip => (self.respond_to?(:master) ? self : parent).master.ip) end end end end \ No newline at end of file