class ChefCLI::Command::Install
Attributes
policyfile_relative_path[R]
ui[RW]
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
ChefCLI::Command::Base::new
# File lib/chef-cli/command/install.rb, line 64 def initialize(*args) super @ui = UI.new @policyfile_relative_path = nil @installer = nil end
Public Instance Methods
apply_params!(params)
click to toggle source
# File lib/chef-cli/command/install.rb, line 109 def apply_params!(params) remaining_args = parse_options(params) if remaining_args.size > 1 ui.err(opt_parser) false else @policyfile_relative_path = remaining_args.first true end end
config_path()
click to toggle source
# File lib/chef-cli/command/install.rb, line 95 def config_path config[:config_file] end
debug?()
click to toggle source
# File lib/chef-cli/command/install.rb, line 91 def debug? !!config[:debug] end
handle_error(error)
click to toggle source
# File lib/chef-cli/command/install.rb, line 99 def handle_error(error) ui.err("Error: #{error.message}") if error.respond_to?(:reason) ui.err("Reason: #{error.reason}") ui.err("") ui.err(error.extended_error_info) if debug? ui.err(error.cause.backtrace.join("\n")) if debug? end end
installer()
click to toggle source
# File lib/chef-cli/command/install.rb, line 87 def installer @installer ||= PolicyfileServices::Install.new(policyfile: policyfile_relative_path, ui: ui, root_dir: Dir.pwd, config: chef_config) end
run(params = [])
click to toggle source
# File lib/chef-cli/command/install.rb, line 72 def run(params = []) return 1 unless apply_params!(params) # Force config file to be loaded. We don't use the configuration # directly, but the user may have SSL configuration options that they # need to talk to a private supermarket (e.g., trusted_certs or # ssl_verify_mode) chef_config installer.run 0 rescue PolicyfileServiceError => e handle_error(e) 1 end