Class: Gusteau::Chef
- Inherits:
-
Object
- Object
- Gusteau::Chef
- Defined in:
- lib/gusteau/chef.rb
Instance Method Summary collapse
-
#initialize(server, platform = nil, dest_dir = '/etc/chef') ⇒ Chef
constructor
A new instance of Chef.
- #run(dna, opts) ⇒ Object
Constructor Details
#initialize(server, platform = nil, dest_dir = '/etc/chef') ⇒ Chef
Returns a new instance of Chef.
4 5 6 7 8 |
# File 'lib/gusteau/chef.rb', line 4 def initialize(server, platform = nil, dest_dir = '/etc/chef') @server = server @platform = platform || 'omnibus' @dest_dir = dest_dir end |
Instance Method Details
#run(dna, opts) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gusteau/chef.rb', line 10 def run(dna, opts) @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 |