Class: Chef::Application::Solo
- Inherits:
-
Chef::Application
- Object
- Chef::Application
- Chef::Application::Solo
- Includes:
- Mixin::ShellOut, ChefConfig::Mixin::DotD
- Defined in:
- lib/chef/application/solo.rb
Constant Summary
Constants included from Mixin::ShellOut
Mixin::ShellOut::DEPRECATED_OPTIONS
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 included from Mixin::ShellOut
#run_command_compatible_options, #shell_out, #shell_out!, #shell_out_with_systems_locale, #shell_out_with_systems_locale!
Methods inherited from Chef::Application
#auto_log_level?, #configure_chef, #configure_encoding, #configure_logging, #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.
205 206 207 |
# File 'lib/chef/application/solo.rb', line 205 def initialize super end |
Instance Attribute Details
#chef_client_json ⇒ Object (readonly)
Returns the value of attribute chef_client_json.
203 204 205 |
# File 'lib/chef/application/solo.rb', line 203 def chef_client_json @chef_client_json end |
Instance Method Details
#reconfigure ⇒ Object
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/chef/application/solo.rb', line 209 def reconfigure super load_dot_d(Chef::Config[:solo_d_dir]) if Chef::Config[:solo_d_dir] 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] Chef::Log.deprecation("-r MUST be changed to --recipe-url, the -r option will be changed in Chef 13.0") if ARGV.include?("-r") if Chef::Config[:recipe_url] cookbooks_path = Array(Chef::Config[:cookbook_path]).detect { |e| Pathname.new(e).cleanpath.to_s =~ /\/cookbooks\/*$/ } recipes_path = File.(File.join(cookbooks_path, "..")) if Chef::Config[:delete_entire_chef_repo] Chef::Log.debug "Cleanup path #{recipes_path} before extract recipes into it" FileUtils.rm_rf(recipes_path, :secure => true) end 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) result = shell_out!("tar zxvf #{tarball_path} -C #{recipes_path}") Chef::Log.debug "#{result.stdout}" 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
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/chef/application/solo.rb', line 257 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.}", 1) end else interval_run_chef_client end end |
#setup_application ⇒ Object
253 254 255 |
# File 'lib/chef/application/solo.rb', line 253 def setup_application Chef::Daemon.change_privilege end |