class ChefCLI::Command::PushArchive
def apply_params!(params)
- Api: - private
def apply_params!(params) remaining_args = parse_options(params) if remaining_args.size != 2 ui.err(opt_parser) return false end @policy_group, @archive_path = remaining_args end
def archive_file
def archive_file File.expand_path(archive_path) end
def debug?
- Api: - private
def debug? !!config[:debug] end
def handle_error(error)
- Api: - private
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 @policy_group = nil @archive_path = nil @chef_config = nil @ui = UI.new end
def push_archive_service
- Api: - private
def push_archive_service @push_archive_service ||= ChefCLI::PolicyfileServices::PushArchive.new( archive_file: archive_file, policy_group: policy_group, ui: ui, config: chef_config ) end
def run(params)
def run(params) return 1 unless apply_params!(params) push_archive_service.run 0 rescue PolicyfileServiceError => e handle_error(e) 1 end