Class: Chef::Application::Solo
- Inherits:
-
Chef::Application
- Object
- Chef::Application
- Chef::Application::Solo
- Defined in:
- lib/chef/application/solo.rb
Instance Attribute Summary collapse
-
#chef_client_json ⇒ Object
readonly
Returns the value of attribute chef_client_json.
Instance Method Summary collapse
-
#initialize ⇒ Solo
constructor
A new instance of Solo.
- #reconfigure ⇒ Object
- #run_application ⇒ Object
- #setup_application ⇒ Object
Methods inherited from Chef::Application
#auto_log_level?, #configure_chef, #configure_encoding, #configure_logging, #configure_proxy_environment_variables, #configure_stdout_logger, debug_stacktrace, exit!, fatal!, #load_config_file, #resolve_log_level, #run, #run_chef_client, #set_specific_recipes, #setup_signal_handlers, #using_output_formatter?, #want_additional_logger?
Constructor Details
#initialize ⇒ Solo
Returns a new instance of Solo.
185 186 187 |
# File 'lib/chef/application/solo.rb', line 185 def initialize super end |
Instance Attribute Details
#chef_client_json ⇒ Object (readonly)
Returns the value of attribute chef_client_json.
183 184 185 |
# File 'lib/chef/application/solo.rb', line 183 def chef_client_json @chef_client_json end |
Instance Method Details
#reconfigure ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/chef/application/solo.rb', line 189 def reconfigure super set_specific_recipes Chef::Config[:solo] = true if Chef::Config[:daemonize] Chef::Config[:interval] ||= 1800 end Chef::Application.fatal!() if !Chef::Config[:client_fork] && Chef::Config[:interval] if Chef::Config[:recipe_url] cookbooks_path = Array(Chef::Config[:cookbook_path]).detect{|e| e =~ /\/cookbooks\/*$/ } recipes_path = File.(File.join(cookbooks_path, '..')) Chef::Log.debug "Cleanup path #{recipes_path} before extract recipes into it" FileUtils.rm_rf(recipes_path, :secure => true) Chef::Log.debug "Creating path #{recipes_path} to extract recipes into" FileUtils.mkdir_p(recipes_path) tarball_path = File.join(recipes_path, 'recipes.tgz') fetch_recipe_tarball(Chef::Config[:recipe_url], tarball_path) Chef::Mixin::Command.run_command(:command => "tar zxvf #{tarball_path} -C #{recipes_path}") end # json_attribs shuld be fetched after recipe_url tarball is unpacked. # Otherwise it may fail if points to local file from tarball. if Chef::Config[:json_attribs] config_fetcher = Chef::ConfigFetcher.new(Chef::Config[:json_attribs]) @chef_client_json = config_fetcher.fetch_json end # Disable auditing for solo Chef::Config[:audit_mode] = :disabled end |
#run_application ⇒ Object
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/chef/application/solo.rb', line 230 def run_application for_ezra if Chef::Config[:ez] if !Chef::Config[:client_fork] || Chef::Config[:once] # Run immediately without interval sleep or splay begin run_chef_client(Chef::Config[:specific_recipes]) rescue SystemExit raise rescue Exception => e Chef::Application.fatal!("#{e.class}: #{e.message}", 1) end else interval_run_chef_client end end |
#setup_application ⇒ Object
226 227 228 |
# File 'lib/chef/application/solo.rb', line 226 def setup_application Chef::Daemon.change_privilege end |