class ChefCLI::Command::Push
def apply_params!(params)
def apply_params!(params) remaining_args = parse_options(params) if remaining_args.size < 1 || remaining_args.size > 2 ui.err(opt_parser) return false else @policy_group = remaining_args[0] @policyfile_relative_path = remaining_args[1] end true end
def debug?
def debug? !!config[:debug] end
def handle_error(error)
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
def initialize(*args)
def initialize(*args) super @push = nil @ui = nil @policy_group = nil @policyfile_relative_path = nil @chef_config = nil @ui = UI.new end
def push
def push @push ||= PolicyfileServices::Push.new(policyfile: policyfile_relative_path, ui: ui, policy_group: policy_group, config: chef_config, root_dir: Dir.pwd) end
def run(params = [])
def run(params = []) return 1 unless apply_params!(params) push.run 0 rescue PolicyfileServiceError => e handle_error(e) 1 end