lib/berkshelf/cli.rb in berkshelf-1.3.1 vs lib/berkshelf/cli.rb in berkshelf-1.4.0.rc1

- old
+ new

@@ -29,11 +29,11 @@ end Berkshelf::Config.path = @options[:config] end if @options[:debug] - Berkshelf.log.level = ::Logger::DEBUG + Berkshelf.logger.level = ::Logger::DEBUG end if @options[:quiet] Berkshelf.ui.mute! end @@ -197,56 +197,42 @@ aliases: "-e" method_option :only, type: :array, desc: "Only cookbooks that are in these groups.", aliases: "-o" - method_option :freeze, + method_option :no_freeze, type: :boolean, default: false, - desc: "Freeze the uploaded cookbooks so that they cannot be overwritten" - option :force, + desc: "Do not freeze uploaded cookbook(s)." + method_option :force, type: :boolean, default: false, - desc: "Upload cookbook(s) even if a frozen one exists on the target Chef Server" - option :ssl_verify, + desc: "Upload all cookbook(s) even if a frozen one exists on the Chef Server." + method_option :ssl_verify, type: :boolean, default: nil, - desc: "Disable/Enable SSL verification when uploading cookbooks" - option :skip_syntax_check, + desc: "Disable/Enable SSL verification when uploading cookbooks." + method_option :skip_syntax_check, type: :boolean, default: false, - desc: "Skip Ruby syntax check when uploading cookbooks", + desc: "Skip Ruby syntax check when uploading cookbooks.", aliases: "-s" - option :skip_dependencies, + method_option :skip_dependencies, type: :boolean, - desc: 'Do not upload dependencies', + desc: "Skip uploading dependent cookbook(s).", default: false, - aliases: '-D' + aliases: "-D" + method_option :halt_on_frozen, + type: :boolean, + default: false, + desc: "Halt uploading and exit if the Chef Server has a frozen version of the cookbook(s)." desc "upload [COOKBOOKS]", "Upload cookbook(s) specified by a Berksfile to the configured Chef Server." def upload(*cookbook_names) berksfile = ::Berkshelf::Berksfile.from_file(options[:berksfile]) - unless Berkshelf::Config.instance.chef.chef_server_url.present? - msg = "Could not upload cookbooks: Missing Chef server_url." - msg << " Generate or update your Berkshelf configuration that contains a valid Chef Server URL." - raise UploadFailure, msg - end - - unless Berkshelf::Config.instance.chef.node_name.present? - msg = "Could not upload cookbooks: Missing Chef node_name." - msg << " Generate or update your Berkshelf configuration that contains a valid Chef node_name." - raise UploadFailure, msg - end - - upload_options = { - server_url: Berkshelf::Config.instance.chef.chef_server_url, - client_name: Berkshelf::Config.instance.chef.node_name, - client_key: Berkshelf::Config.instance.chef.client_key, - ssl: { - verify: (options[:ssl_verify].nil? ? Berkshelf::Config.instance.ssl.verify : options[:ssl_verify]) - }, - cookbooks: cookbook_names - }.merge(options).symbolize_keys + upload_options = Hash[options.except(:no_freeze, :berksfile)].symbolize_keys + upload_options[:cookbooks] = cookbook_names + upload_options[:freeze] = false if options[:no_freeze] berksfile.upload(upload_options) end method_option :berksfile,