Class: Gusteau::Chef
Instance Method Summary collapse
-
#initialize(server, platform = nil) ⇒ Chef
constructor
A new instance of Chef.
- #run(dna, opts) ⇒ Object
Methods included from ERB
Constructor Details
#initialize(server, platform = nil) ⇒ Chef
Returns a new instance of Chef.
7 8 9 10 |
# File 'lib/gusteau/chef.rb', line 7 def initialize(server, platform = nil) @server = server @platform = platform || 'omnibus' end |
Instance Method Details
#run(dna, opts) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gusteau/chef.rb', line 12 def run(dna, opts) dest_dir = Gusteau::Config.settings['chef_config_dir'] @server.run "rm -rf #{dest_dir} && mkdir #{dest_dir} && mkdir -p /tmp/chef" with_gusteau_dir(dna[:path]) do |dir| @server.upload [dir], dest_dir, :exclude => '.git/', :strip_c => 2 end @server.run "sh /etc/chef/bootstrap.sh #{Gusteau::Config.settings['chef_version']}" if opts['bootstrap'] cmd = "unset GEM_HOME; unset GEM_PATH; chef-solo -c #{dest_dir}/solo.rb -j #{dest_dir}/dna.json --color" cmd << " -F #{opts['format']}" if opts['format'] cmd << " -l #{opts['log_level']}" if opts['log_level'] cmd << " -W" if opts['why-run'] @server.run cmd end |