summaryrefslogtreecommitdiff
path: root/lib/chef/knife
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/knife')
-rw-r--r--lib/chef/knife/bootstrap.rb12
-rw-r--r--lib/chef/knife/bootstrap/chef_vault_handler.rb2
-rw-r--r--lib/chef/knife/client_key_create.rb2
-rw-r--r--lib/chef/knife/client_key_delete.rb2
-rw-r--r--lib/chef/knife/client_key_edit.rb3
-rw-r--r--lib/chef/knife/client_key_list.rb2
-rw-r--r--lib/chef/knife/client_key_show.rb2
-rw-r--r--lib/chef/knife/configure.rb4
-rw-r--r--lib/chef/knife/cookbook_bulk_delete.rb3
-rw-r--r--lib/chef/knife/cookbook_create.rb12
-rw-r--r--lib/chef/knife/cookbook_delete.rb2
-rw-r--r--lib/chef/knife/cookbook_download.rb1
-rw-r--r--lib/chef/knife/cookbook_show.rb4
-rw-r--r--lib/chef/knife/cookbook_site_download.rb1
-rw-r--r--lib/chef/knife/cookbook_site_install.rb2
-rw-r--r--lib/chef/knife/cookbook_site_list.rb8
-rw-r--r--lib/chef/knife/cookbook_site_search.rb7
-rw-r--r--lib/chef/knife/cookbook_site_share.rb3
-rw-r--r--lib/chef/knife/cookbook_site_show.rb7
-rw-r--r--lib/chef/knife/cookbook_test.rb1
-rw-r--r--lib/chef/knife/cookbook_upload.rb9
-rw-r--r--lib/chef/knife/core/cookbook_scm_repo.rb5
-rw-r--r--lib/chef/knife/core/gem_glob_loader.rb6
-rw-r--r--lib/chef/knife/core/generic_presenter.rb15
-rw-r--r--lib/chef/knife/core/hashed_command_loader.rb2
-rw-r--r--lib/chef/knife/core/node_presenter.rb7
-rw-r--r--lib/chef/knife/core/status_presenter.rb4
-rw-r--r--lib/chef/knife/core/subcommand_loader.rb5
-rw-r--r--lib/chef/knife/core/text_formatter.rb4
-rw-r--r--lib/chef/knife/core/ui.rb9
-rw-r--r--lib/chef/knife/data_bag_delete.rb2
-rw-r--r--lib/chef/knife/data_bag_edit.rb3
-rw-r--r--lib/chef/knife/data_bag_from_file.rb1
-rw-r--r--lib/chef/knife/data_bag_list.rb4
-rw-r--r--lib/chef/knife/delete.rb1
-rw-r--r--lib/chef/knife/deps.rb6
-rw-r--r--lib/chef/knife/diff.rb1
-rw-r--r--lib/chef/knife/download.rb1
-rw-r--r--lib/chef/knife/edit.rb1
-rw-r--r--lib/chef/knife/environment_compare.rb34
-rw-r--r--lib/chef/knife/environment_from_file.rb1
-rw-r--r--lib/chef/knife/help.rb4
-rw-r--r--lib/chef/knife/index_rebuild.rb1
-rw-r--r--lib/chef/knife/key_create.rb2
-rw-r--r--lib/chef/knife/key_edit.rb2
-rw-r--r--lib/chef/knife/key_list.rb2
-rw-r--r--lib/chef/knife/node_bulk_delete.rb8
-rw-r--r--lib/chef/knife/node_create.rb3
-rw-r--r--lib/chef/knife/node_delete.rb1
-rw-r--r--lib/chef/knife/node_edit.rb2
-rw-r--r--lib/chef/knife/node_environment_set.rb2
-rw-r--r--lib/chef/knife/node_from_file.rb6
-rw-r--r--lib/chef/knife/node_list.rb2
-rw-r--r--lib/chef/knife/node_run_list_add.rb2
-rw-r--r--lib/chef/knife/node_show.rb1
-rw-r--r--lib/chef/knife/raw.rb2
-rw-r--r--lib/chef/knife/rehash.rb4
-rw-r--r--lib/chef/knife/role_bulk_delete.rb5
-rw-r--r--lib/chef/knife/role_create.rb2
-rw-r--r--lib/chef/knife/role_delete.rb1
-rw-r--r--lib/chef/knife/role_edit.rb3
-rw-r--r--lib/chef/knife/role_env_run_list_add.rb4
-rw-r--r--lib/chef/knife/role_env_run_list_remove.rb16
-rw-r--r--lib/chef/knife/role_env_run_list_replace.rb2
-rw-r--r--lib/chef/knife/role_from_file.rb5
-rw-r--r--lib/chef/knife/role_list.rb1
-rw-r--r--lib/chef/knife/role_run_list_add.rb4
-rw-r--r--lib/chef/knife/role_run_list_remove.rb16
-rw-r--r--lib/chef/knife/role_run_list_replace.rb2
-rw-r--r--lib/chef/knife/role_show.rb3
-rw-r--r--lib/chef/knife/search.rb4
-rw-r--r--lib/chef/knife/serve.rb2
-rw-r--r--lib/chef/knife/ssh.rb14
-rw-r--r--lib/chef/knife/ssl_check.rb3
-rw-r--r--lib/chef/knife/ssl_fetch.rb6
-rw-r--r--lib/chef/knife/status.rb10
-rw-r--r--lib/chef/knife/upload.rb1
-rw-r--r--lib/chef/knife/user_create.rb4
-rw-r--r--lib/chef/knife/user_delete.rb3
-rw-r--r--lib/chef/knife/user_edit.rb3
-rw-r--r--lib/chef/knife/user_key_create.rb2
-rw-r--r--lib/chef/knife/user_key_delete.rb2
-rw-r--r--lib/chef/knife/user_key_edit.rb3
-rw-r--r--lib/chef/knife/user_key_list.rb2
-rw-r--r--lib/chef/knife/user_key_show.rb2
-rw-r--r--lib/chef/knife/user_reregister.rb3
-rw-r--r--lib/chef/knife/user_show.rb2
-rw-r--r--lib/chef/knife/xargs.rb3
88 files changed, 145 insertions, 233 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index a1172aefc9..7982c0f927 100644
--- a/lib/chef/knife/bootstrap.rb
+++ b/lib/chef/knife/bootstrap.rb
@@ -250,7 +250,7 @@ class Chef
Chef::Config[:knife][:bootstrap_vault_item]
}
- def initialize(argv=[])
+ def initialize(argv = [])
super
@client_builder = Chef::Knife::Bootstrap::ClientBuilder.new(
chef_config: Chef::Config,
@@ -312,8 +312,8 @@ class Chef
bootstrap_files = []
bootstrap_files << File.join(File.dirname(__FILE__), "bootstrap/templates", "#{template}.erb")
bootstrap_files << File.join(Knife.chef_config_dir, "bootstrap", "#{template}.erb") if Chef::Knife.chef_config_dir
- Chef::Util::PathHelper.home(".chef", "bootstrap", "#{template}.erb") {|p| bootstrap_files << p}
- bootstrap_files << Gem.find_files(File.join("chef","knife","bootstrap","#{template}.erb"))
+ Chef::Util::PathHelper.home(".chef", "bootstrap", "#{template}.erb") { |p| bootstrap_files << p }
+ bootstrap_files << Gem.find_files(File.join("chef", "knife", "bootstrap", "#{template}.erb"))
bootstrap_files.flatten!
template_file = Array(bootstrap_files).find do |bootstrap_template|
@@ -367,8 +367,8 @@ class Chef
# chef-vault integration must use the new client-side hawtness, otherwise to use the
# new client-side hawtness, just delete your validation key.
- if chef_vault_handler.doing_chef_vault? ||
- (Chef::Config[:validation_key] && !File.exist?(File.expand_path(Chef::Config[:validation_key])))
+ if chef_vault_handler.doing_chef_vault? ||
+ (Chef::Config[:validation_key] && !File.exist?(File.expand_path(Chef::Config[:validation_key])))
unless config[:chef_node_name]
ui.error("You must pass a node name with -N when bootstrapping with user credentials")
@@ -449,7 +449,7 @@ class Chef
if config[:use_sudo]
sudo_prefix = config[:use_sudo_password] ? "echo '#{config[:ssh_password]}' | sudo -S " : "sudo "
- command = config[:preserve_home] ? "#{sudo_prefix} #{command}" : "#{sudo_prefix} -H #{command}"
+ command = config[:preserve_home] ? "#{sudo_prefix} #{command}" : "#{sudo_prefix} -H #{command}"
end
command
diff --git a/lib/chef/knife/bootstrap/chef_vault_handler.rb b/lib/chef/knife/bootstrap/chef_vault_handler.rb
index ca37cc5544..86eed6a8a6 100644
--- a/lib/chef/knife/bootstrap/chef_vault_handler.rb
+++ b/lib/chef/knife/bootstrap/chef_vault_handler.rb
@@ -136,7 +136,7 @@ class Chef
ChefVault::Item.load(vault, item)
end
- public :load_chef_bootstrap_vault_item # for stubbing
+ public :load_chef_bootstrap_vault_item # for stubbing
# Helper to very lazily require the chef-vault gem
def require_chef_vault!
diff --git a/lib/chef/knife/client_key_create.rb b/lib/chef/knife/client_key_create.rb
index 520798013e..68ad4d16d2 100644
--- a/lib/chef/knife/client_key_create.rb
+++ b/lib/chef/knife/client_key_create.rb
@@ -32,7 +32,7 @@ class Chef
attr_reader :actor
- def initialize(argv=[])
+ def initialize(argv = [])
super(argv)
@service_object = nil
end
diff --git a/lib/chef/knife/client_key_delete.rb b/lib/chef/knife/client_key_delete.rb
index 3e27148475..64eae2e27c 100644
--- a/lib/chef/knife/client_key_delete.rb
+++ b/lib/chef/knife/client_key_delete.rb
@@ -31,7 +31,7 @@ class Chef
attr_reader :actor
- def initialize(argv=[])
+ def initialize(argv = [])
super(argv)
@service_object = nil
end
diff --git a/lib/chef/knife/client_key_edit.rb b/lib/chef/knife/client_key_edit.rb
index 65657520bb..1dbd3c487b 100644
--- a/lib/chef/knife/client_key_edit.rb
+++ b/lib/chef/knife/client_key_edit.rb
@@ -34,7 +34,7 @@ class Chef
attr_reader :actor
- def initialize(argv=[])
+ def initialize(argv = [])
super(argv)
@service_object = nil
end
@@ -77,4 +77,3 @@ class Chef
end
end
end
-
diff --git a/lib/chef/knife/client_key_list.rb b/lib/chef/knife/client_key_list.rb
index 01e0fe2b25..194ad42931 100644
--- a/lib/chef/knife/client_key_list.rb
+++ b/lib/chef/knife/client_key_list.rb
@@ -34,7 +34,7 @@ class Chef
attr_reader :actor
- def initialize(argv=[])
+ def initialize(argv = [])
super(argv)
@service_object = nil
end
diff --git a/lib/chef/knife/client_key_show.rb b/lib/chef/knife/client_key_show.rb
index 1611631a67..77f9e96c5a 100644
--- a/lib/chef/knife/client_key_show.rb
+++ b/lib/chef/knife/client_key_show.rb
@@ -31,7 +31,7 @@ class Chef
attr_reader :actor
- def initialize(argv=[])
+ def initialize(argv = [])
super(argv)
@service_object = nil
end
diff --git a/lib/chef/knife/configure.rb b/lib/chef/knife/configure.rb
index c48ecb7442..e62a9dd05c 100644
--- a/lib/chef/knife/configure.rb
+++ b/lib/chef/knife/configure.rb
@@ -97,7 +97,7 @@ EOH
user_create = Chef::Knife::UserCreate.new
user_create.name_args = [ new_client_name ]
user_create.config[:user_password] = config[:user_password] ||
- ui.ask("Please enter a password for the new user: ") {|q| q.echo = false}
+ ui.ask("Please enter a password for the new user: ") { |q| q.echo = false }
user_create.config[:admin] = true
user_create.config[:file] = new_client_key
user_create.config[:yes] = true
@@ -133,7 +133,7 @@ EOH
def ask_user_for_config
server_name = guess_servername
- @chef_server = config[:chef_server_url] || ask_question("Please enter the chef server URL: ", :default => "https://#{server_name}:443")
+ @chef_server = config[:chef_server_url] || ask_question("Please enter the chef server URL: ", :default => "https://#{server_name}:443")
if config[:initial]
@new_client_name = config[:node_name] || ask_question("Please enter a name for the new user: ", :default => Etc.getlogin)
@admin_client_name = config[:admin_client_name] || ask_question("Please enter the existing admin name: ", :default => "admin")
diff --git a/lib/chef/knife/cookbook_bulk_delete.rb b/lib/chef/knife/cookbook_bulk_delete.rb
index 5ab97dc408..6c2ad5a53f 100644
--- a/lib/chef/knife/cookbook_bulk_delete.rb
+++ b/lib/chef/knife/cookbook_bulk_delete.rb
@@ -58,9 +58,8 @@ class Chef
ui.msg ""
end
-
cookbooks_names.each do |cookbook_name|
- versions = rest.get("cookbooks/#{cookbook_name}")[cookbook_name]["versions"].map {|v| v["version"]}.flatten
+ versions = rest.get("cookbooks/#{cookbook_name}")[cookbook_name]["versions"].map { |v| v["version"] }.flatten
versions.each do |version|
object = rest.delete("cookbooks/#{cookbook_name}/#{version}#{config[:purge] ? "?purge=true" : ""}")
ui.info("Deleted cookbook #{cookbook_name.ljust(25)} [#{version}]")
diff --git a/lib/chef/knife/cookbook_create.rb b/lib/chef/knife/cookbook_create.rb
index 2aeecc6e2a..1e19535fbf 100644
--- a/lib/chef/knife/cookbook_create.rb
+++ b/lib/chef/knife/cookbook_create.rb
@@ -182,11 +182,11 @@ EOH
def create_changelog(dir, cookbook_name)
msg("** Creating CHANGELOG for cookbook: #{cookbook_name}")
- unless File.exists?(File.join(dir,cookbook_name,"CHANGELOG.md"))
- open(File.join(dir, cookbook_name, "CHANGELOG.md"),"w") do |file|
+ unless File.exists?(File.join(dir, cookbook_name, "CHANGELOG.md"))
+ open(File.join(dir, cookbook_name, "CHANGELOG.md"), "w") do |file|
file.puts <<-EOH
#{cookbook_name} CHANGELOG
-#{'='*"#{cookbook_name} CHANGELOG".length}
+#{'=' * "#{cookbook_name} CHANGELOG".length}
This file is used to list changes made in each version of the #{cookbook_name} cookbook.
@@ -271,10 +271,10 @@ e.g.
== License and Authors
Authors: TODO: List authors
EOH
- when "md","mkd","txt"
+ when "md", "mkd", "txt"
file.puts <<-EOH
#{cookbook_name} Cookbook
-#{'='*"#{cookbook_name} Cookbook".length}
+#{'=' * "#{cookbook_name} Cookbook".length}
TODO: Enter the cookbook description here.
e.g.
@@ -345,7 +345,7 @@ EOH
else
file.puts <<-EOH
#{cookbook_name} Cookbook
-#{'='*"#{cookbook_name} Cookbook".length}
+#{'=' * "#{cookbook_name} Cookbook".length}
TODO: Enter the cookbook description here.
e.g.
diff --git a/lib/chef/knife/cookbook_delete.rb b/lib/chef/knife/cookbook_delete.rb
index e6a70d693c..b1bb88b388 100644
--- a/lib/chef/knife/cookbook_delete.rb
+++ b/lib/chef/knife/cookbook_delete.rb
@@ -86,7 +86,7 @@ class Chef
def available_versions
@available_versions ||= rest.get("cookbooks/#{@cookbook_name}").map do |name, url_and_version|
- url_and_version["versions"].map {|url_by_version| url_by_version["version"]}
+ url_and_version["versions"].map { |url_by_version| url_by_version["version"] }
end.flatten
rescue Net::HTTPServerException => e
if e.to_s =~ /^404/
diff --git a/lib/chef/knife/cookbook_download.rb b/lib/chef/knife/cookbook_download.rb
index 8c8f0cc677..741f444093 100644
--- a/lib/chef/knife/cookbook_download.rb
+++ b/lib/chef/knife/cookbook_download.rb
@@ -98,7 +98,6 @@ class Chef
end
def determine_version
-
if available_versions.nil?
nil
elsif available_versions.size == 1
diff --git a/lib/chef/knife/cookbook_show.rb b/lib/chef/knife/cookbook_show.rb
index 1a1ba36825..20013cea4b 100644
--- a/lib/chef/knife/cookbook_show.rb
+++ b/lib/chef/knife/cookbook_show.rb
@@ -96,7 +96,3 @@ class Chef
end
end
end
-
-
-
-
diff --git a/lib/chef/knife/cookbook_site_download.rb b/lib/chef/knife/cookbook_site_download.rb
index 541e60c977..7e4eda015f 100644
--- a/lib/chef/knife/cookbook_site_download.rb
+++ b/lib/chef/knife/cookbook_site_download.rb
@@ -57,6 +57,7 @@ class Chef
end
private
+
def cookbooks_api_url
"https://supermarket.chef.io/api/v1/cookbooks"
end
diff --git a/lib/chef/knife/cookbook_site_install.rb b/lib/chef/knife/cookbook_site_install.rb
index 14be2d750f..9a79cd076a 100644
--- a/lib/chef/knife/cookbook_site_install.rb
+++ b/lib/chef/knife/cookbook_site_install.rb
@@ -142,7 +142,7 @@ class Chef
def extract_cookbook(upstream_file, version)
ui.info("Uncompressing #{@cookbook_name} version #{version}.")
# FIXME: Detect if we have the bad tar from git on Windows: https://github.com/opscode/chef/issues/1753
- extract_command="tar zxvf \"#{convert_path upstream_file}\""
+ extract_command = "tar zxvf \"#{convert_path upstream_file}\""
if Chef::Platform.windows?
extract_command << " --force-local"
end
diff --git a/lib/chef/knife/cookbook_site_list.rb b/lib/chef/knife/cookbook_site_list.rb
index 2c7c5d6df2..abe48bf340 100644
--- a/lib/chef/knife/cookbook_site_list.rb
+++ b/lib/chef/knife/cookbook_site_list.rb
@@ -33,14 +33,14 @@ class Chef
def run
if config[:with_uri]
cookbooks = Hash.new
- get_cookbook_list.each{ |k,v| cookbooks[k] = v["cookbook"] }
+ get_cookbook_list.each { |k, v| cookbooks[k] = v["cookbook"] }
ui.output(format_for_display(cookbooks))
else
ui.msg(ui.list(get_cookbook_list.keys.sort, :columns_down))
end
end
- def get_cookbook_list(items=10, start=0, cookbook_collection={})
+ def get_cookbook_list(items = 10, start = 0, cookbook_collection = {})
cookbooks_url = "https://supermarket.chef.io/api/v1/cookbooks?items=#{items}&start=#{start}"
cr = noauth_rest.get(cookbooks_url)
cr["items"].each do |cookbook|
@@ -56,7 +56,3 @@ class Chef
end
end
end
-
-
-
-
diff --git a/lib/chef/knife/cookbook_site_search.rb b/lib/chef/knife/cookbook_site_search.rb
index 2629761385..ba4b873efc 100644
--- a/lib/chef/knife/cookbook_site_search.rb
+++ b/lib/chef/knife/cookbook_site_search.rb
@@ -28,7 +28,7 @@ class Chef
output(search_cookbook(name_args[0]))
end
- def search_cookbook(query, items=10, start=0, cookbook_collection={})
+ def search_cookbook(query, items = 10, start = 0, cookbook_collection = {})
cookbooks_url = "https://supermarket.chef.io/api/v1/search?q=#{query}&items=#{items}&start=#{start}"
cr = noauth_rest.get(cookbooks_url)
cr["items"].each do |cookbook|
@@ -44,8 +44,3 @@ class Chef
end
end
end
-
-
-
-
-
diff --git a/lib/chef/knife/cookbook_site_share.rb b/lib/chef/knife/cookbook_site_share.rb
index fcb666dbae..fc5517cebc 100644
--- a/lib/chef/knife/cookbook_site_share.rb
+++ b/lib/chef/knife/cookbook_site_share.rb
@@ -103,7 +103,6 @@ class Chef
ui.error("Could not find cookbook #{cookbook_name} in your cookbook path.")
exit(1)
end
-
end
def get_category(cookbook_name)
@@ -125,7 +124,7 @@ class Chef
def do_upload(cookbook_filename, cookbook_category, user_id, user_secret_filename)
uri = "https://supermarket.chef.io/api/v1/cookbooks"
- category_string = Chef::JSONCompat.to_json({ "category"=>cookbook_category })
+ category_string = Chef::JSONCompat.to_json({ "category" => cookbook_category })
http_resp = Chef::CookbookSiteStreamingUploader.post(uri, user_id, user_secret_filename, {
:tarball => File.open(cookbook_filename),
diff --git a/lib/chef/knife/cookbook_site_show.rb b/lib/chef/knife/cookbook_site_show.rb
index 2956ca2879..a6a4c82c85 100644
--- a/lib/chef/knife/cookbook_site_show.rb
+++ b/lib/chef/knife/cookbook_site_show.rb
@@ -37,7 +37,7 @@ class Chef
end
end
- def get_cookbook_list(items=10, start=0, cookbook_collection={})
+ def get_cookbook_list(items = 10, start = 0, cookbook_collection = {})
cookbooks_url = "https://supermarket.chef.io/api/v1/cookbooks?items=#{items}&start=#{start}"
cr = noauth_rest.get(cookbooks_url)
cr["items"].each do |cookbook|
@@ -53,8 +53,3 @@ class Chef
end
end
end
-
-
-
-
-
diff --git a/lib/chef/knife/cookbook_test.rb b/lib/chef/knife/cookbook_test.rb
index f7931e321b..ee42facf5e 100644
--- a/lib/chef/knife/cookbook_test.rb
+++ b/lib/chef/knife/cookbook_test.rb
@@ -76,7 +76,6 @@ class Chef
end
end
-
def test_ruby(syntax_checker)
ui.info("Validating ruby files")
exit(1) unless syntax_checker.validate_ruby_files
diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb
index 9cbd8f09d1..e16e21ae64 100644
--- a/lib/chef/knife/cookbook_upload.rb
+++ b/lib/chef/knife/cookbook_upload.rb
@@ -101,7 +101,7 @@ class Chef
# Get a list of cookbooks and their versions from the server
# to check for the existence of a cookbook's dependencies.
@server_side_cookbooks = Chef::CookbookVersion.list_all_versions
- justify_width = @server_side_cookbooks.map {|name| name.size}.max.to_i + 2
+ justify_width = @server_side_cookbooks.map { |name| name.size }.max.to_i + 2
if config[:all]
cookbook_repo.load_cookbooks
cookbooks_for_upload = []
@@ -145,7 +145,6 @@ class Chef
end
end
-
upload_failures += @name_args.length - @cookbooks_to_upload.length
if upload_failures == 0
@@ -259,7 +258,7 @@ WARNING
info[CHECKSUM].nil? || info[CHECKSUM] !~ MATCH_CHECKSUM
end
unless broken_files.empty?
- broken_filenames = Array(broken_files).map {|path, info| path}
+ broken_filenames = Array(broken_files).map { |path, info| path }
ui.error "The cookbook #{cookbook.name} has one or more broken files"
ui.error "This is probably caused by broken symlinks in the cookbook directory"
ui.error "The broken file(s) are: #{broken_filenames.join(' ')}"
@@ -275,7 +274,7 @@ WARNING
end
unless missing_dependencies.empty?
- missing_cookbook_names = missing_dependencies.map { |cookbook_name, version| "'#{cookbook_name}' version '#{version}'"}
+ missing_cookbook_names = missing_dependencies.map { |cookbook_name, version| "'#{cookbook_name}' version '#{version}'" }
ui.error "Cookbook #{cookbook.name} depends on cookbooks which are not currently"
ui.error "being uploaded and cannot be found on the server."
ui.error "The missing cookbook(s) are: #{missing_cookbook_names.join(', ')}"
@@ -287,7 +286,7 @@ WARNING
if @server_side_cookbooks[cookbook_name].nil?
false
else
- versions = @server_side_cookbooks[cookbook_name]["versions"].collect {|versions| versions["version"]}
+ versions = @server_side_cookbooks[cookbook_name]["versions"].collect { |versions| versions["version"] }
Log.debug "Versions of cookbook '#{cookbook_name}' returned by the server: #{versions.join(", ")}"
@server_side_cookbooks[cookbook_name]["versions"].each do |versions_hash|
if Chef::VersionConstraint.new(version).include?(versions_hash["version"])
diff --git a/lib/chef/knife/core/cookbook_scm_repo.rb b/lib/chef/knife/core/cookbook_scm_repo.rb
index 4779bb5405..e909066b02 100644
--- a/lib/chef/knife/core/cookbook_scm_repo.rb
+++ b/lib/chef/knife/core/cookbook_scm_repo.rb
@@ -31,7 +31,7 @@ class Chef
attr_reader :use_current_branch
attr_reader :ui
- def initialize(repo_path, ui, opts={})
+ def initialize(repo_path, ui, opts = {})
@repo_path = repo_path
@ui = ui
@default_branch = "master"
@@ -119,7 +119,7 @@ class Chef
end
def branch_exists?(branch_name)
- git("branch --no-color").stdout.lines.any? {|l| l =~ /\s#{Regexp.escape(branch_name)}(?:\s|$)/ }
+ git("branch --no-color").stdout.lines.any? { |l| l =~ /\s#{Regexp.escape(branch_name)}(?:\s|$)/ }
end
def get_current_branch()
@@ -157,4 +157,3 @@ class Chef
end
end
end
-
diff --git a/lib/chef/knife/core/gem_glob_loader.rb b/lib/chef/knife/core/gem_glob_loader.rb
index 2aabf4cf46..6802be29ef 100644
--- a/lib/chef/knife/core/gem_glob_loader.rb
+++ b/lib/chef/knife/core/gem_glob_loader.rb
@@ -50,7 +50,7 @@ class Chef
files = Dir[File.join(Chef::Util::PathHelper.escape_glob(File.expand_path("../../../knife", __FILE__)), "*.rb")]
subcommand_files = {}
files.each do |knife_file|
- rel_path = knife_file[/#{CHEF_ROOT}#{Regexp.escape(File::SEPARATOR)}(.*)\.rb/,1]
+ rel_path = knife_file[/#{CHEF_ROOT}#{Regexp.escape(File::SEPARATOR)}(.*)\.rb/, 1]
subcommand_files[rel_path] = knife_file
end
subcommand_files
@@ -77,7 +77,7 @@ class Chef
private
- def find_files_latest_gems(glob, check_load_path=true)
+ def find_files_latest_gems(glob, check_load_path = true)
files = []
if check_load_path
@@ -103,7 +103,7 @@ class Chef
def latest_gem_specs
@latest_gem_specs ||= if Gem::Specification.respond_to? :latest_specs
- Gem::Specification.latest_specs(true) # find prerelease gems
+ Gem::Specification.latest_specs(true) # find prerelease gems
else
Gem.source_index.latest_specs(true)
end
diff --git a/lib/chef/knife/core/generic_presenter.rb b/lib/chef/knife/core/generic_presenter.rb
index 4ba9a15100..bbe0249b3d 100644
--- a/lib/chef/knife/core/generic_presenter.rb
+++ b/lib/chef/knife/core/generic_presenter.rb
@@ -32,7 +32,7 @@ class Chef
option :attribute,
:short => "-a ATTR1 [-a ATTR2]",
:long => "--attribute ATTR1 [--attribute ATTR2] ",
- :proc => lambda {|val| @attrs_to_show << val},
+ :proc => lambda { |val| @attrs_to_show << val },
:description => "Show one or more attributes"
end
end
@@ -133,7 +133,7 @@ class Chef
end
def format_list_for_display(list)
- config[:with_uri] ? list : list.keys.sort { |a,b| a <=> b }
+ config[:with_uri] ? list : list.keys.sort { |a, b| a <=> b }
end
def format_for_display(data)
@@ -142,7 +142,7 @@ class Chef
elsif config[:id_only]
name_or_id_for(data)
elsif config[:environment] && data.respond_to?(:chef_environment)
- {"chef_environment" => data.chef_environment}
+ { "chef_environment" => data.chef_environment }
else
data
end
@@ -162,7 +162,7 @@ class Chef
else
raise ArgumentError, "format_data_subset_for_display requires attribute, run_list, or id_only config option to be set"
end
- {name_or_id_for(data) => subset }
+ { name_or_id_for(data) => subset }
end
def name_or_id_for(data)
@@ -173,7 +173,6 @@ class Chef
config[:attribute] || config[:run_list]
end
-
def extract_nested_value(data, nested_value_spec)
nested_value_spec.split(".").each do |attr|
if data.nil?
@@ -181,7 +180,7 @@ class Chef
# Must check :[] before attr because spec can include
# `keys` - want the key named `keys`, not a list of
# available keys.
- elsif data.respond_to?(:[]) && data.has_key?(attr)
+ elsif data.respond_to?(:[]) && data.has_key?(attr)
data = data[attr]
elsif data.respond_to?(attr.to_sym)
data = data.send(attr.to_sym)
@@ -207,10 +206,10 @@ class Chef
end
else
versions_by_cookbook = item.inject({}) do |collected, ( cookbook, versions )|
- collected[cookbook] = versions["versions"].map {|v| v["version"]}
+ collected[cookbook] = versions["versions"].map { |v| v["version"] }
collected
end
- key_length = versions_by_cookbook.empty? ? 0 : versions_by_cookbook.keys.map {|name| name.size }.max + 2
+ key_length = versions_by_cookbook.empty? ? 0 : versions_by_cookbook.keys.map { |name| name.size }.max + 2
versions_by_cookbook.sort.map do |cookbook, versions|
"#{cookbook.ljust(key_length)} #{versions.join(' ')}"
end
diff --git a/lib/chef/knife/core/hashed_command_loader.rb b/lib/chef/knife/core/hashed_command_loader.rb
index aecf738332..7b6c1c4c08 100644
--- a/lib/chef/knife/core/hashed_command_loader.rb
+++ b/lib/chef/knife/core/hashed_command_loader.rb
@@ -38,7 +38,7 @@ class Chef
find_longest_key(manifest[KEY]["plugins_by_category"], category_words, " ")
end
- def list_commands(pref_category=nil)
+ def list_commands(pref_category = nil)
if pref_category || manifest[KEY]["plugins_by_category"].key?(pref_category)
{ pref_category => manifest[KEY]["plugins_by_category"][pref_category] }
else
diff --git a/lib/chef/knife/core/node_presenter.rb b/lib/chef/knife/core/node_presenter.rb
index a5837f268c..cdb664ec33 100644
--- a/lib/chef/knife/core/node_presenter.rb
+++ b/lib/chef/knife/core/node_presenter.rb
@@ -98,7 +98,7 @@ class Chef
# special case ec2 with their split horizon whatsis.
ip = (node[:ec2] && node[:ec2][:public_ipv4]) || node[:ipaddress]
- summarized=<<-SUMMARY
+ summarized = <<-SUMMARY
#{ui.color('Node Name:', :bold)} #{ui.color(node.name, :bold)}
SUMMARY
show_policy = !(node.policy_name.nil? && node.policy_group.nil?)
@@ -128,13 +128,13 @@ ROLES
#{key('Tags:')} #{node.tags.join(', ')}
SUMMARY
if config[:medium_output] || config[:long_output]
- summarized +=<<-MORE
+ summarized += <<-MORE
#{key('Attributes:')}
#{text_format(node.normal_attrs)}
MORE
end
if config[:long_output]
- summarized +=<<-MOST
+ summarized += <<-MOST
#{key('Default Attributes:')}
#{text_format(node.default_attrs)}
#{key('Override Attributes:')}
@@ -157,4 +157,3 @@ MOST
end
end
end
-
diff --git a/lib/chef/knife/core/status_presenter.rb b/lib/chef/knife/core/status_presenter.rb
index 13bcf5cab2..68c1acf4f1 100644
--- a/lib/chef/knife/core/status_presenter.rb
+++ b/lib/chef/knife/core/status_presenter.rb
@@ -93,7 +93,7 @@ class Chef
# the volume of output is adjusted accordingly. Uses colors if enabled
# in the ui object.
def summarize(list)
- summarized=""
+ summarized = ""
list.each do |data|
node = data
# special case ec2 with their split horizon whatsis.
@@ -130,7 +130,7 @@ class Chef
line_parts << platform
end
- summarized=summarized + line_parts.join(", ") + ".\n"
+ summarized = summarized + line_parts.join(", ") + ".\n"
end
summarized
end
diff --git a/lib/chef/knife/core/subcommand_loader.rb b/lib/chef/knife/core/subcommand_loader.rb
index 2b8bbc929d..95ab219c80 100644
--- a/lib/chef/knife/core/subcommand_loader.rb
+++ b/lib/chef/knife/core/subcommand_loader.rb
@@ -96,7 +96,7 @@ class Chef
end
def force_load
- @loaded=false
+ @loaded = false
load_commands
end
@@ -128,7 +128,6 @@ class Chef
category_words, " ")
end
-
#
# This is shared between the custom_manifest_loader and the gem_glob_loader
#
@@ -137,7 +136,7 @@ class Chef
files = Dir[File.join(Chef::Util::PathHelper.escape_glob(File.expand_path("../../../knife", __FILE__)), "*.rb")]
subcommand_files = {}
files.each do |knife_file|
- rel_path = knife_file[/#{CHEF_ROOT}#{Regexp.escape(File::SEPARATOR)}(.*)\.rb/,1]
+ rel_path = knife_file[/#{CHEF_ROOT}#{Regexp.escape(File::SEPARATOR)}(.*)\.rb/, 1]
subcommand_files[rel_path] = knife_file
end
subcommand_files
diff --git a/lib/chef/knife/core/text_formatter.rb b/lib/chef/knife/core/text_formatter.rb
index 006a6fc9cf..8775e2e76f 100644
--- a/lib/chef/knife/core/text_formatter.rb
+++ b/lib/chef/knife/core/text_formatter.rb
@@ -45,7 +45,7 @@ class Chef
buffer = ""
if data.respond_to?(:keys)
- justify_width = data.keys.map {|k| k.to_s.size }.max.to_i + 1
+ justify_width = data.keys.map { |k| k.to_s.size }.max.to_i + 1
data.sort.each do |key, value|
# key: ['value'] should be printed as key: value
if value.kind_of?(Array) && value.size == 1 && is_singleton(value[0])
@@ -68,7 +68,7 @@ class Chef
buffer << text_format(data[index])
# Separate items with newlines if it's an array of hashes or an
# array of arrays
- buffer << "\n" if !is_singleton(data[index]) && index != data.size-1
+ buffer << "\n" if !is_singleton(data[index]) && index != data.size - 1
end
else
buffer << "#{data}\n"
diff --git a/lib/chef/knife/core/ui.rb b/lib/chef/knife/core/ui.rb
index f5002c8598..ee92127898 100644
--- a/lib/chef/knife/core/ui.rb
+++ b/lib/chef/knife/core/ui.rb
@@ -137,7 +137,7 @@ class Chef
@presenter.interchange?
end
- def ask_question(question, opts={})
+ def ask_question(question, opts = {})
question = question + "[#{opts[:default]}] " if opts[:default]
if opts[:default] and config[:defaults]
@@ -163,7 +163,6 @@ class Chef
end
end
-
# Hash -> Hash
# Works the same as edit_data but
# returns a hash rather than a JSON string/Fully infated object
@@ -172,7 +171,7 @@ class Chef
Chef::JSONCompat.parse(raw)
end
- def edit_data(data, parse_output=true)
+ def edit_data(data, parse_output = true)
output = Chef::JSONCompat.to_json_pretty(data)
if (!config[:disable_editing])
Tempfile.open([ "knife-edit-", ".json" ]) do |tf|
@@ -226,7 +225,7 @@ class Chef
end
# See confirm method for argument information
- def confirm_without_exit(question, append_instructions=true, default_choice=nil)
+ def confirm_without_exit(question, append_instructions = true, default_choice = nil)
return true if config[:yes]
stdout.print question
@@ -264,7 +263,7 @@ class Chef
# append_instructions => Should print '? (Y/N)' as instructions
# default_choice => Set to true for 'Y', and false for 'N' as default answer
#
- def confirm(question, append_instructions=true, default_choice=nil)
+ def confirm(question, append_instructions = true, default_choice = nil)
unless confirm_without_exit(question, append_instructions, default_choice)
exit 3
end
diff --git a/lib/chef/knife/data_bag_delete.rb b/lib/chef/knife/data_bag_delete.rb
index a3cb008ec0..c1ea2013c8 100644
--- a/lib/chef/knife/data_bag_delete.rb
+++ b/lib/chef/knife/data_bag_delete.rb
@@ -47,5 +47,3 @@ class Chef
end
end
end
-
-
diff --git a/lib/chef/knife/data_bag_edit.rb b/lib/chef/knife/data_bag_edit.rb
index c9ce079a22..ba39207db1 100644
--- a/lib/chef/knife/data_bag_edit.rb
+++ b/lib/chef/knife/data_bag_edit.rb
@@ -72,6 +72,3 @@ class Chef
end
end
end
-
-
-
diff --git a/lib/chef/knife/data_bag_from_file.rb b/lib/chef/knife/data_bag_from_file.rb
index f2cbb1369b..e029ec4b22 100644
--- a/lib/chef/knife/data_bag_from_file.rb
+++ b/lib/chef/knife/data_bag_from_file.rb
@@ -60,6 +60,7 @@ class Chef
end
private
+
def data_bags_path
@data_bag_path ||= "data_bags"
end
diff --git a/lib/chef/knife/data_bag_list.rb b/lib/chef/knife/data_bag_list.rb
index a2b700f186..d507925ec8 100644
--- a/lib/chef/knife/data_bag_list.rb
+++ b/lib/chef/knife/data_bag_list.rb
@@ -40,7 +40,3 @@ class Chef
end
end
end
-
-
-
-
diff --git a/lib/chef/knife/delete.rb b/lib/chef/knife/delete.rb
index aeb4744873..d5d4a4c4bd 100644
--- a/lib/chef/knife/delete.rb
+++ b/lib/chef/knife/delete.rb
@@ -105,4 +105,3 @@ class Chef
end
end
end
-
diff --git a/lib/chef/knife/deps.rb b/lib/chef/knife/deps.rb
index 0be83a8bf1..99a24e405b 100644
--- a/lib/chef/knife/deps.rb
+++ b/lib/chef/knife/deps.rb
@@ -61,12 +61,12 @@ class Chef
def print_dependencies_tree(entry, dependencies, printed = {}, depth = 0)
dependencies[entry.path] = get_dependencies(entry) if !dependencies[entry.path]
- output "#{' '*depth}#{format_path(entry)}"
+ output "#{' ' * depth}#{format_path(entry)}"
if !printed[entry.path] && (config[:recurse] || depth == 0)
printed[entry.path] = true
dependencies[entry.path].each do |child|
child_entry = Chef::ChefFS::FileSystem.resolve_path(@root, child)
- print_dependencies_tree(child_entry, dependencies, printed, depth+1)
+ print_dependencies_tree(child_entry, dependencies, printed, depth + 1)
end
end
end
@@ -96,7 +96,7 @@ class Chef
end
end
if role["env_run_lists"]
- role["env_run_lists"].each_pair do |env,run_list|
+ role["env_run_lists"].each_pair do |env, run_list|
dependencies_from_runlist(run_list).each do |dependency|
result << dependency if !result.include?(dependency)
end
diff --git a/lib/chef/knife/diff.rb b/lib/chef/knife/diff.rb
index 580e9e513f..d965490f0a 100644
--- a/lib/chef/knife/diff.rb
+++ b/lib/chef/knife/diff.rb
@@ -66,4 +66,3 @@ class Chef
end
end
end
-
diff --git a/lib/chef/knife/download.rb b/lib/chef/knife/download.rb
index f2af0e0152..c609760509 100644
--- a/lib/chef/knife/download.rb
+++ b/lib/chef/knife/download.rb
@@ -66,4 +66,3 @@ class Chef
end
end
end
-
diff --git a/lib/chef/knife/edit.rb b/lib/chef/knife/edit.rb
index 608ce82a8f..00358b2d09 100644
--- a/lib/chef/knife/edit.rb
+++ b/lib/chef/knife/edit.rb
@@ -70,4 +70,3 @@ class Chef
end
end
end
-
diff --git a/lib/chef/knife/environment_compare.rb b/lib/chef/knife/environment_compare.rb
index 1a3389e2c8..8a2ef853d3 100644
--- a/lib/chef/knife/environment_compare.rb
+++ b/lib/chef/knife/environment_compare.rb
@@ -15,37 +15,37 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
+
require "chef/knife"
-
+
class Chef
class Knife
class EnvironmentCompare < Knife
-
+
deps do
require "chef/environment"
end
-
+
banner "knife environment compare [ENVIRONMENT..] (options)"
option :all,
:short => "-a",
:long => "--all",
:description => "Show all cookbooks",
- :boolean => true
+ :boolean => true
option :mismatch,
:short => "-m",
:long => "--mismatch",
:description => "Only show mismatching versions",
:boolean => true
-
+
def run
# Get the commandline environments or all if none are provided.
- environments = environment_list
+ environments = environment_list
# Get a list of all cookbooks that have constraints and their environment.
- constraints = constraint_list(environments)
+ constraints = constraint_list(environments)
# Get the total list of cookbooks that have constraints
cookbooks = cookbook_list(constraints)
@@ -55,7 +55,7 @@ class Chef
ui.error "Cannot find any environment cookbook constraints"
exit 1
end
-
+
# Get all cookbooks so we can compare them all
cookbooks = rest.get("/cookbooks?num_versions=1") if config[:all]
@@ -77,11 +77,11 @@ class Chef
else
environments = Chef::Environment.list
end
- end
+ end
def constraint_list(environments)
constraints = {}
- environments.each do |env,url|
+ environments.each do |env, url|
# Because you cannot modify the default environment I filter it out here.
unless env == "_default"
envdata = Chef::Environment.load(env)
@@ -91,22 +91,22 @@ class Chef
end
constraints
end
-
+
def cookbook_list(constraints)
result = {}
constraints.each { |env, cb| result.merge!(cb) }
result
- end
+ end
def matrix_output(cookbooks, constraints)
rows = [ "" ]
environments = []
- constraints.each { |e,v| environments << e.to_s }
+ constraints.each { |e, v| environments << e.to_s }
columns = environments.count + 1
environments.each { |env| rows << ui.color(env, :bold) }
- cookbooks.each do |c,v|
+ cookbooks.each do |c, v|
total = []
- environments.each { |n| total << constraints[n][c]}
+ environments.each { |n| total << constraints[n][c] }
if total.uniq.count == 1
next if config[:mismatch]
color = :white
@@ -116,7 +116,7 @@ class Chef
rows << ui.color(c, :bold)
environments.each do |e|
tag = constraints[e][c] || "latest"
- rows << ui.color(tag, color)
+ rows << ui.color(tag, color)
end
end
ui.list(rows, :uneven_columns_across, columns)
diff --git a/lib/chef/knife/environment_from_file.rb b/lib/chef/knife/environment_from_file.rb
index 4640632b32..5272c8934a 100644
--- a/lib/chef/knife/environment_from_file.rb
+++ b/lib/chef/knife/environment_from_file.rb
@@ -62,7 +62,6 @@ class Chef
ui.info("Updated Environment #{updated.name}")
end
-
def run
if config[:all] == true
load_all_environments
diff --git a/lib/chef/knife/help.rb b/lib/chef/knife/help.rb
index f4221f233a..e45b54eec8 100644
--- a/lib/chef/knife/help.rb
+++ b/lib/chef/knife/help.rb
@@ -43,8 +43,6 @@ MOAR_HELP
@query = name_args.join("-")
end
-
-
case @query
when "topics", "list"
print_help_topics
@@ -67,7 +65,7 @@ MOAR_HELP
def print_help_topics
ui.info "Available help topics are: "
- help_topics.collect {|t| t.gsub(/knife-/, "") }.sort.each do |topic|
+ help_topics.collect { |t| t.gsub(/knife-/, "") }.sort.each do |topic|
ui.msg " #{topic}"
end
end
diff --git a/lib/chef/knife/index_rebuild.rb b/lib/chef/knife/index_rebuild.rb
index c317d767b5..eb85b8d7be 100644
--- a/lib/chef/knife/index_rebuild.rb
+++ b/lib/chef/knife/index_rebuild.rb
@@ -40,7 +40,6 @@ class Chef
nag
output rest.post("/search/reindex", {})
end
-
end
def grab_api_info
diff --git a/lib/chef/knife/key_create.rb b/lib/chef/knife/key_create.rb
index 9288fd91e8..55c4f4ef36 100644
--- a/lib/chef/knife/key_create.rb
+++ b/lib/chef/knife/key_create.rb
@@ -40,7 +40,7 @@ class Chef
end
def public_key_or_key_name_error_msg
-<<EOS
+ <<EOS
You must pass either --public-key or --key-name, or both.
If you only pass --public-key, a key name will be generated from the fingerprint of your key.
If you only pass --key-name, a key pair will be generated by the server.
diff --git a/lib/chef/knife/key_edit.rb b/lib/chef/knife/key_edit.rb
index 8bc9ad21b8..cd54e61cb6 100644
--- a/lib/chef/knife/key_edit.rb
+++ b/lib/chef/knife/key_edit.rb
@@ -41,7 +41,7 @@ class Chef
end
def public_key_and_create_key_error_msg
-<<EOS
+ <<EOS
You passed both --public-key and --create-key. Only pass one, or the other, or neither.
Do not pass either if you do not want to change the public_key field of your key.
Pass --public-key if you want to update the public_key field of your key from a specific public key.
diff --git a/lib/chef/knife/key_list.rb b/lib/chef/knife/key_list.rb
index a6320b1603..9a820b7a50 100644
--- a/lib/chef/knife/key_list.rb
+++ b/lib/chef/knife/key_list.rb
@@ -40,7 +40,7 @@ class Chef
end
def expired_and_non_expired_msg
-<<EOS
+ <<EOS
You cannot pass both --only-expired and --only-non-expired.
Please pass one or none.
EOS
diff --git a/lib/chef/knife/node_bulk_delete.rb b/lib/chef/knife/node_bulk_delete.rb
index 8c0529db2c..2ca63da512 100644
--- a/lib/chef/knife/node_bulk_delete.rb
+++ b/lib/chef/knife/node_bulk_delete.rb
@@ -35,7 +35,6 @@ class Chef
exit 42
end
-
nodes_to_delete = {}
matcher = /#{name_args[0]}/
@@ -55,7 +54,6 @@ class Chef
ui.msg("")
ui.confirm("Are you sure you want to delete these nodes")
-
nodes_to_delete.sort.each do |name, node|
node.destroy
ui.msg("Deleted node #{name}")
@@ -66,7 +64,7 @@ class Chef
node_uris_by_name = Chef::Node.list
node_uris_by_name.keys.inject({}) do |nodes_by_name, name|
- nodes_by_name[name] = Chef::Node.new.tap {|n| n.name(name)}
+ nodes_by_name[name] = Chef::Node.new.tap { |n| n.name(name) }
nodes_by_name
end
end
@@ -74,7 +72,3 @@ class Chef
end
end
end
-
-
-
-
diff --git a/lib/chef/knife/node_create.rb b/lib/chef/knife/node_create.rb
index bcbb00e363..21d67f1355 100644
--- a/lib/chef/knife/node_create.rb
+++ b/lib/chef/knife/node_create.rb
@@ -45,6 +45,3 @@ class Chef
end
end
end
-
-
-
diff --git a/lib/chef/knife/node_delete.rb b/lib/chef/knife/node_delete.rb
index 10c728c60e..4dd7d764a1 100644
--- a/lib/chef/knife/node_delete.rb
+++ b/lib/chef/knife/node_delete.rb
@@ -44,4 +44,3 @@ class Chef
end
end
end
-
diff --git a/lib/chef/knife/node_edit.rb b/lib/chef/knife/node_edit.rb
index a232ec5c4e..4632c0a5b4 100644
--- a/lib/chef/knife/node_edit.rb
+++ b/lib/chef/knife/node_edit.rb
@@ -68,5 +68,3 @@ class Chef
end
end
end
-
-
diff --git a/lib/chef/knife/node_environment_set.rb b/lib/chef/knife/node_environment_set.rb
index 30517df45e..ecba01be29 100644
--- a/lib/chef/knife/node_environment_set.rb
+++ b/lib/chef/knife/node_environment_set.rb
@@ -46,7 +46,7 @@ class Chef
config[:attribute] = "chef_environment"
- output(format_for_display(node))
+ output(format_for_display(node))
end
end
diff --git a/lib/chef/knife/node_from_file.rb b/lib/chef/knife/node_from_file.rb
index 661834e277..8e05e2798a 100644
--- a/lib/chef/knife/node_from_file.rb
+++ b/lib/chef/knife/node_from_file.rb
@@ -37,11 +37,11 @@ class Chef
def run
@name_args.each do |arg|
updated = loader.load_from("nodes", arg)
-
+
updated.save
-
+
output(format_for_display(updated)) if config[:print_after]
-
+
ui.info("Updated Node #{updated.name}!")
end
end
diff --git a/lib/chef/knife/node_list.rb b/lib/chef/knife/node_list.rb
index a726b2ded3..4885208136 100644
--- a/lib/chef/knife/node_list.rb
+++ b/lib/chef/knife/node_list.rb
@@ -42,5 +42,3 @@ class Chef
end
end
end
-
-
diff --git a/lib/chef/knife/node_run_list_add.rb b/lib/chef/knife/node_run_list_add.rb
index 2cb6d30b87..f8d40c8321 100644
--- a/lib/chef/knife/node_run_list_add.rb
+++ b/lib/chef/knife/node_run_list_add.rb
@@ -73,7 +73,7 @@ class Chef
private
- def add_to_run_list_after(node, entries, after=nil)
+ def add_to_run_list_after(node, entries, after = nil)
if after
nlist = []
node.run_list.each do |entry|
diff --git a/lib/chef/knife/node_show.rb b/lib/chef/knife/node_show.rb
index 14a7a35b21..c616b8ab72 100644
--- a/lib/chef/knife/node_show.rb
+++ b/lib/chef/knife/node_show.rb
@@ -64,4 +64,3 @@ class Chef
end
end
end
-
diff --git a/lib/chef/knife/raw.rb b/lib/chef/knife/raw.rb
index 80fbf97dcc..56527a00f2 100644
--- a/lib/chef/knife/raw.rb
+++ b/lib/chef/knife/raw.rb
@@ -71,7 +71,7 @@ class Chef
begin
method = config[:method].to_sym
- headers = {"Content-Type" => "application/json"}
+ headers = { "Content-Type" => "application/json" }
if config[:proxy_auth]
headers["x-ops-request-source"] = "web"
diff --git a/lib/chef/knife/rehash.rb b/lib/chef/knife/rehash.rb
index 7c16260fed..3e7bab7e0f 100644
--- a/lib/chef/knife/rehash.rb
+++ b/lib/chef/knife/rehash.rb
@@ -21,7 +21,7 @@ require "chef/knife/core/subcommand_loader"
class Chef
class Knife
- class Rehash < Chef::Knife
+ class Rehash < Chef::Knife
banner "knife rehash"
def run
@@ -42,7 +42,7 @@ class Chef
output = if Chef::Knife::SubcommandLoader.plugin_manifest?
Chef::Knife::SubcommandLoader.plugin_manifest
else
- { Chef::Knife::SubcommandLoader::HashedCommandLoader::KEY => {}}
+ { Chef::Knife::SubcommandLoader::HashedCommandLoader::KEY => {} }
end
output[Chef::Knife::SubcommandLoader::HashedCommandLoader::KEY]["plugins_paths"] = Chef::Knife.subcommand_files
output[Chef::Knife::SubcommandLoader::HashedCommandLoader::KEY]["plugins_by_category"] = Chef::Knife.subcommands_by_category
diff --git a/lib/chef/knife/role_bulk_delete.rb b/lib/chef/knife/role_bulk_delete.rb
index 2ec0afb182..0726454da3 100644
--- a/lib/chef/knife/role_bulk_delete.rb
+++ b/lib/chef/knife/role_bulk_delete.rb
@@ -63,8 +63,3 @@ class Chef
end
end
end
-
-
-
-
-
diff --git a/lib/chef/knife/role_create.rb b/lib/chef/knife/role_create.rb
index 23bf0c372b..7e581f42d6 100644
--- a/lib/chef/knife/role_create.rb
+++ b/lib/chef/knife/role_create.rb
@@ -51,5 +51,3 @@ class Chef
end
end
end
-
-
diff --git a/lib/chef/knife/role_delete.rb b/lib/chef/knife/role_delete.rb
index 4162f5b9f4..5c10a05d85 100644
--- a/lib/chef/knife/role_delete.rb
+++ b/lib/chef/knife/role_delete.rb
@@ -44,4 +44,3 @@ class Chef
end
end
end
-
diff --git a/lib/chef/knife/role_edit.rb b/lib/chef/knife/role_edit.rb
index 129d55cacd..d3697849ad 100644
--- a/lib/chef/knife/role_edit.rb
+++ b/lib/chef/knife/role_edit.rb
@@ -43,6 +43,3 @@ class Chef
end
end
end
-
-
-
diff --git a/lib/chef/knife/role_env_run_list_add.rb b/lib/chef/knife/role_env_run_list_add.rb
index 207484597e..61aec506a9 100644
--- a/lib/chef/knife/role_env_run_list_add.rb
+++ b/lib/chef/knife/role_env_run_list_add.rb
@@ -34,13 +34,13 @@ class Chef
:long => "--after ITEM",
:description => "Place the ENTRY in the run list after ITEM"
- def add_to_env_run_list(role, environment, entries, after=nil)
+ def add_to_env_run_list(role, environment, entries, after = nil)
if after
nlist = []
unless role.env_run_lists.key?(environment)
role.env_run_lists_add(environment => nlist)
end
- role.run_list_for(environment).each do |entry|
+ role.run_list_for(environment).each do |entry|
nlist << entry
if entry == after
entries.each { |e| nlist << e }
diff --git a/lib/chef/knife/role_env_run_list_remove.rb b/lib/chef/knife/role_env_run_list_remove.rb
index ae30d0a884..576e32e2a9 100644
--- a/lib/chef/knife/role_env_run_list_remove.rb
+++ b/lib/chef/knife/role_env_run_list_remove.rb
@@ -30,14 +30,14 @@ class Chef
banner "knife role env_run_list remove [ROLE] [ENVIRONMENT] [ENTRIES]"
def remove_from_env_run_list(role, environment, item_to_remove)
- nlist = []
- role.run_list_for(environment).each do |entry|
- nlist << entry unless entry == item_to_remove
- #unless entry == @name_args[2]
- # nlist << entry
- #end
- end
- role.env_run_lists_add(environment => nlist)
+ nlist = []
+ role.run_list_for(environment).each do |entry|
+ nlist << entry unless entry == item_to_remove
+ #unless entry == @name_args[2]
+ # nlist << entry
+ #end
+ end
+ role.env_run_lists_add(environment => nlist)
end
def run
diff --git a/lib/chef/knife/role_env_run_list_replace.rb b/lib/chef/knife/role_env_run_list_replace.rb
index ae0c7a63b5..e84e351c1e 100644
--- a/lib/chef/knife/role_env_run_list_replace.rb
+++ b/lib/chef/knife/role_env_run_list_replace.rb
@@ -31,7 +31,7 @@ class Chef
def replace_in_env_run_list(role, environment, old_entry, new_entry)
nlist = []
- role.run_list_for(environment).each do |entry|
+ role.run_list_for(environment).each do |entry|
if entry == old_entry
nlist << new_entry
else
diff --git a/lib/chef/knife/role_from_file.rb b/lib/chef/knife/role_from_file.rb
index 157c8b8889..e1f4737ab9 100644
--- a/lib/chef/knife/role_from_file.rb
+++ b/lib/chef/knife/role_from_file.rb
@@ -49,8 +49,3 @@ class Chef
end
end
end
-
-
-
-
-
diff --git a/lib/chef/knife/role_list.rb b/lib/chef/knife/role_list.rb
index 02a1bcb43e..1247478ef5 100644
--- a/lib/chef/knife/role_list.rb
+++ b/lib/chef/knife/role_list.rb
@@ -40,4 +40,3 @@ class Chef
end
end
end
-
diff --git a/lib/chef/knife/role_run_list_add.rb b/lib/chef/knife/role_run_list_add.rb
index 3ce0439a7f..6aa92d37ba 100644
--- a/lib/chef/knife/role_run_list_add.rb
+++ b/lib/chef/knife/role_run_list_add.rb
@@ -34,13 +34,13 @@ class Chef
:long => "--after ITEM",
:description => "Place the ENTRY in the run list after ITEM"
- def add_to_env_run_list(role, environment, entries, after=nil)
+ def add_to_env_run_list(role, environment, entries, after = nil)
if after
nlist = []
unless role.env_run_lists.key?(environment)
role.env_run_lists_add(environment => nlist)
end
- role.run_list_for(environment).each do |entry|
+ role.run_list_for(environment).each do |entry|
nlist << entry
if entry == after
entries.each { |e| nlist << e }
diff --git a/lib/chef/knife/role_run_list_remove.rb b/lib/chef/knife/role_run_list_remove.rb
index f9f8e1dbb1..0dacfee051 100644
--- a/lib/chef/knife/role_run_list_remove.rb
+++ b/lib/chef/knife/role_run_list_remove.rb
@@ -30,14 +30,14 @@ class Chef
banner "knife role run_list remove [ROLE] [ENTRY]"
def remove_from_env_run_list(role, environment, item_to_remove)
- nlist = []
- role.run_list_for(environment).each do |entry|
- nlist << entry unless entry == item_to_remove
- #unless entry == @name_args[2]
- # nlist << entry
- #end
- end
- role.env_run_lists_add(environment => nlist)
+ nlist = []
+ role.run_list_for(environment).each do |entry|
+ nlist << entry unless entry == item_to_remove
+ #unless entry == @name_args[2]
+ # nlist << entry
+ #end
+ end
+ role.env_run_lists_add(environment => nlist)
end
def run
diff --git a/lib/chef/knife/role_run_list_replace.rb b/lib/chef/knife/role_run_list_replace.rb
index e12a77d487..3e7bc2d5ec 100644
--- a/lib/chef/knife/role_run_list_replace.rb
+++ b/lib/chef/knife/role_run_list_replace.rb
@@ -31,7 +31,7 @@ class Chef
def replace_in_env_run_list(role, environment, old_entry, new_entry)
nlist = []
- role.run_list_for(environment).each do |entry|
+ role.run_list_for(environment).each do |entry|
if entry == old_entry
nlist << new_entry
else
diff --git a/lib/chef/knife/role_show.rb b/lib/chef/knife/role_show.rb
index a3af0baf6a..99684768bb 100644
--- a/lib/chef/knife/role_show.rb
+++ b/lib/chef/knife/role_show.rb
@@ -31,7 +31,6 @@ class Chef
banner "knife role show ROLE (options)"
-
def run
@role_name = @name_args[0]
@@ -48,5 +47,3 @@ class Chef
end
end
end
-
-
diff --git a/lib/chef/knife/search.rb b/lib/chef/knife/search.rb
index ecb323abe3..30a3db3cf2 100644
--- a/lib/chef/knife/search.rb
+++ b/lib/chef/knife/search.rb
@@ -106,7 +106,7 @@ class Chef
formatted_item = Hash.new
if item.is_a?(Hash)
# doing a little magic here to set the correct name
- formatted_item[item["__display_name"]] = item.reject{|k| k == "__display_name"}
+ formatted_item[item["__display_name"]] = item.reject { |k| k == "__display_name" }
else
formatted_item = format_for_display(item)
end
@@ -120,7 +120,7 @@ class Chef
end
if ui.interchange?
- output({:results => result_count, :rows => result_items})
+ output({ :results => result_count, :rows => result_items })
else
ui.log "#{result_count} items found"
ui.log("\n")
diff --git a/lib/chef/knife/serve.rb b/lib/chef/knife/serve.rb
index 3f97962eae..f74a5c1d1d 100644
--- a/lib/chef/knife/serve.rb
+++ b/lib/chef/knife/serve.rb
@@ -4,7 +4,7 @@ require "chef/local_mode"
class Chef
class Knife
class Serve < Knife
-
+
banner "knife serve (options)"
option :repo_mode,
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index fb36fb67f4..728ee671bc 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -165,7 +165,7 @@ class Chef
if @action_nodes.length == 0
ui.fatal("No nodes returned from search!")
else
- ui.fatal("#{@action_nodes.length} #{@action_nodes.length > 1 ? "nodes": "node"} found, " +
+ ui.fatal("#{@action_nodes.length} #{@action_nodes.length > 1 ? "nodes" : "node"} found, " +
"but does not have the required attribute to establish the connection. " +
"Try setting another attribute to open the connection using --attribute.")
end
@@ -209,7 +209,7 @@ class Chef
next if item.nil?
# next if we couldn't find the specified attribute in the
# returned node object
- host = extract_nested_value(item,get_ssh_attribute(item))
+ host = extract_nested_value(item, get_ssh_attribute(item))
next if host.nil?
ssh_port = item[:cloud].nil? ? nil : item[:cloud][:public_ssh_port]
srv = [host, ssh_port]
@@ -227,7 +227,7 @@ class Chef
# @param port [String] SSH port for this session.
# @param user [String] Optional username for this session.
# @return [Hash<Symbol, Object>]
- def session_options(host, port, user=nil)
+ def session_options(host, port, user = nil)
ssh_config = Net::SSH.configuration_for(host)
{}.tap do |opts|
# Chef::Config[:knife][:ssh_user] is parsed in #configure_user and written to config[:ssh_user]
@@ -297,7 +297,7 @@ class Chef
ui.msg(str)
end
- def ssh_command(command, subsession=nil)
+ def ssh_command(command, subsession = nil)
exit_status = 0
subsession ||= session
command = fixup_sudo(command)
@@ -425,7 +425,7 @@ class Chef
end.join(" \\; ")
end
- tmux_name = "'knife ssh #{@name_args[0].gsub(/:/,'=')}'"
+ tmux_name = "'knife ssh #{@name_args[0].gsub(/:/, '=')}'"
begin
server = session.servers_for.first
cmd = ["tmux new-session -d -s #{tmux_name}",
@@ -446,13 +446,13 @@ class Chef
end
Appscript.app("/Applications/Utilities/Terminal.app").windows.first.activate
- Appscript.app("System Events").application_processes["Terminal.app"].keystroke("n", :using=>:command_down)
+ Appscript.app("System Events").application_processes["Terminal.app"].keystroke("n", :using => :command_down)
term = Appscript.app("Terminal")
window = term.windows.first.get
(session.servers_for.size - 1).times do |i|
window.activate
- Appscript.app("System Events").application_processes["Terminal.app"].keystroke("t", :using=>:command_down)
+ Appscript.app("System Events").application_processes["Terminal.app"].keystroke("t", :using => :command_down)
end
session.servers_for.each_with_index do |server, tab_number|
diff --git a/lib/chef/knife/ssl_check.rb b/lib/chef/knife/ssl_check.rb
index 87cb82c8b1..6dac06b27b 100644
--- a/lib/chef/knife/ssl_check.rb
+++ b/lib/chef/knife/ssl_check.rb
@@ -206,7 +206,7 @@ ADVICE
def debug_invalid_host
noverify_socket.connect
subject = noverify_socket.peer_cert.subject
- cn_field_tuple = subject.to_a.find {|field| field[0] == "CN" }
+ cn_field_tuple = subject.to_a.find { |field| field[0] == "CN" }
cn = cn_field_tuple[1]
ui.error("You are attempting to connect to: '#{host}'")
@@ -253,6 +253,7 @@ ADVICE
end
private
+
def trusted_certificates
if configuration.trusted_certs_dir && Dir.exist?(configuration.trusted_certs_dir)
Dir.glob(File.join(configuration.trusted_certs_dir, "*.{crt,pem}"))
diff --git a/lib/chef/knife/ssl_fetch.rb b/lib/chef/knife/ssl_fetch.rb
index 3d9db57c07..f694a46ac6 100644
--- a/lib/chef/knife/ssl_fetch.rb
+++ b/lib/chef/knife/ssl_fetch.rb
@@ -87,10 +87,9 @@ class Chef
end
end
-
def cn_of(certificate)
subject = certificate.subject
- cn_field_tuple = subject.to_a.find {|field| field[0] == "CN" }
+ cn_field_tuple = subject.to_a.find { |field| field[0] == "CN" }
cn_field_tuple[1]
end
@@ -120,7 +119,7 @@ class Chef
cn = cn_of(cert)
filename = File.join(trusted_certs_dir, "#{normalize_cn(cn)}.crt")
ui.msg("Adding certificate for #{cn} in #{filename}")
- File.open(filename, File::CREAT|File::TRUNC|File::RDWR, 0644) do |f|
+ File.open(filename, File::CREAT | File::TRUNC | File::RDWR, 0644) do |f|
f.print(cert.to_s)
end
end
@@ -153,7 +152,6 @@ TRUST_TRUST
exit 1
end
-
end
end
end
diff --git a/lib/chef/knife/status.rb b/lib/chef/knife/status.rb
index 48e7a2a49d..7bf9abbd1b 100644
--- a/lib/chef/knife/status.rb
+++ b/lib/chef/knife/status.rb
@@ -61,10 +61,10 @@ class Chef
if config[:long_output]
opts = {}
else
- opts = {filter_result:
+ opts = { filter_result:
{ name: ["name"], ipaddress: ["ipaddress"], ohai_time: ["ohai_time"],
- ec2: ["ec2"], run_list: ["run_list"], platform: ["platform"],
- platform_version: ["platform_version"], chef_environment: ["chef_environment"]}}
+ ec2: ["ec2"], run_list: ["run_list"], platform: ["platform"],
+ platform_version: ["platform_version"], chef_environment: ["chef_environment"] } }
end
@query ||= ""
@@ -76,7 +76,7 @@ class Chef
time = Time.now.to_i
# AND NOT is not valid lucene syntax, so don't use append_to_query
@query << " " unless @query.empty?
- @query << "NOT ohai_time:[#{(time - 60*60)} TO #{time}]"
+ @query << "NOT ohai_time:[#{(time - 60 * 60)} TO #{time}]"
end
if config[:hide_by_mins]
@@ -84,7 +84,7 @@ class Chef
time = Time.now.to_i
# AND NOT is not valid lucene syntax, so don't use append_to_query
@query << " " unless @query.empty?
- @query << "NOT ohai_time:[#{(time - hidemins*60)} TO #{time}]"
+ @query << "NOT ohai_time:[#{(time - hidemins * 60)} TO #{time}]"
end
@query = @query.empty? ? "*:*" : @query
diff --git a/lib/chef/knife/upload.rb b/lib/chef/knife/upload.rb
index 90b9a1562b..d0bf89fa7f 100644
--- a/lib/chef/knife/upload.rb
+++ b/lib/chef/knife/upload.rb
@@ -68,4 +68,3 @@ class Chef
end
end
end
-
diff --git a/lib/chef/knife/user_create.rb b/lib/chef/knife/user_create.rb
index 9613ec795d..5a9589aad8 100644
--- a/lib/chef/knife/user_create.rb
+++ b/lib/chef/knife/user_create.rb
@@ -69,7 +69,7 @@ class Chef
end
def osc_11_warning
-<<-EOF
+ <<-EOF
IF YOU ARE USING CHEF SERVER 12+, PLEASE FOLLOW THE INSTRUCTIONS UNDER knife user create --help.
You only passed a single argument to knife user create.
For backwards compatibility, when only a single argument is passed,
@@ -144,8 +144,6 @@ EOF
end
end
end
-
-
end
end
end
diff --git a/lib/chef/knife/user_delete.rb b/lib/chef/knife/user_delete.rb
index a6eb89bc17..ce4575ceab 100644
--- a/lib/chef/knife/user_delete.rb
+++ b/lib/chef/knife/user_delete.rb
@@ -30,7 +30,7 @@ class Chef
banner "knife user delete USER (options)"
def osc_11_warning
-<<-EOF
+ <<-EOF
The Chef Server you are using does not support the username field.
This means it is an Open Source 11 Server.
knife user delete for Open Source 11 Server is being deprecated.
@@ -89,7 +89,6 @@ EOF
else # proceed with EC / CS delete
delete_object(@user_name)
end
-
end
end
end
diff --git a/lib/chef/knife/user_edit.rb b/lib/chef/knife/user_edit.rb
index 5aa1c56796..9564a31b15 100644
--- a/lib/chef/knife/user_edit.rb
+++ b/lib/chef/knife/user_edit.rb
@@ -30,7 +30,7 @@ class Chef
banner "knife user edit USER (options)"
def osc_11_warning
-<<-EOF
+ <<-EOF
The Chef Server you are using does not support the username field.
This means it is an Open Source 11 Server.
knife user edit for Open Source 11 Server is being deprecated.
@@ -75,7 +75,6 @@ EOF
ui.msg("User unchanged, not saving.")
end
end
-
end
end
end
diff --git a/lib/chef/knife/user_key_create.rb b/lib/chef/knife/user_key_create.rb
index c5c983979d..95a98a2f4f 100644
--- a/lib/chef/knife/user_key_create.rb
+++ b/lib/chef/knife/user_key_create.rb
@@ -34,7 +34,7 @@ class Chef
attr_reader :actor
- def initialize(argv=[])
+ def initialize(argv = [])
super(argv)
@service_object = nil
end
diff --git a/lib/chef/knife/user_key_delete.rb b/lib/chef/knife/user_key_delete.rb
index 1dafc4879d..1c559f2ef0 100644
--- a/lib/chef/knife/user_key_delete.rb
+++ b/lib/chef/knife/user_key_delete.rb
@@ -31,7 +31,7 @@ class Chef
attr_reader :actor
- def initialize(argv=[])
+ def initialize(argv = [])
super(argv)
@service_object = nil
end
diff --git a/lib/chef/knife/user_key_edit.rb b/lib/chef/knife/user_key_edit.rb
index ce59876e39..561af8edd0 100644
--- a/lib/chef/knife/user_key_edit.rb
+++ b/lib/chef/knife/user_key_edit.rb
@@ -34,7 +34,7 @@ class Chef
attr_reader :actor
- def initialize(argv=[])
+ def initialize(argv = [])
super(argv)
@service_object = nil
end
@@ -77,4 +77,3 @@ class Chef
end
end
end
-
diff --git a/lib/chef/knife/user_key_list.rb b/lib/chef/knife/user_key_list.rb
index 1d777bad18..799c069182 100644
--- a/lib/chef/knife/user_key_list.rb
+++ b/lib/chef/knife/user_key_list.rb
@@ -34,7 +34,7 @@ class Chef
attr_reader :actor
- def initialize(argv=[])
+ def initialize(argv = [])
super(argv)
@service_object = nil
end
diff --git a/lib/chef/knife/user_key_show.rb b/lib/chef/knife/user_key_show.rb
index 3887238b20..e09d5e04ed 100644
--- a/lib/chef/knife/user_key_show.rb
+++ b/lib/chef/knife/user_key_show.rb
@@ -31,7 +31,7 @@ class Chef
attr_reader :actor
- def initialize(argv=[])
+ def initialize(argv = [])
super(argv)
@service_object = nil
end
diff --git a/lib/chef/knife/user_reregister.rb b/lib/chef/knife/user_reregister.rb
index 3e093da6a5..8d2f2c1e73 100644
--- a/lib/chef/knife/user_reregister.rb
+++ b/lib/chef/knife/user_reregister.rb
@@ -30,7 +30,7 @@ class Chef
banner "knife user reregister USER (options)"
def osc_11_warning
-<<-EOF
+ <<-EOF
The Chef Server you are using does not support the username field.
This means it is an Open Source 11 Server.
knife user reregister for Open Source 11 Server is being deprecated.
@@ -83,7 +83,6 @@ EOF
ui.msg key
end
end
-
end
end
end
diff --git a/lib/chef/knife/user_show.rb b/lib/chef/knife/user_show.rb
index 0f70b86603..04251c0863 100644
--- a/lib/chef/knife/user_show.rb
+++ b/lib/chef/knife/user_show.rb
@@ -32,7 +32,7 @@ class Chef
banner "knife user show USER (options)"
def osc_11_warning
-<<-EOF
+ <<-EOF
The Chef Server you are using does not support the username field.
This means it is an Open Source 11 Server.
knife user show for Open Source 11 Server is being deprecated.
diff --git a/lib/chef/knife/xargs.rb b/lib/chef/knife/xargs.rb
index f16890cba5..10e15a4257 100644
--- a/lib/chef/knife/xargs.rb
+++ b/lib/chef/knife/xargs.rb
@@ -22,7 +22,7 @@ class Chef
:long => "--pattern [PATTERN]",
:short => "-p [PATTERN]",
:description => "Pattern on command line (if these are not specified, a list of patterns is expected on standard input). Multiple patterns may be passed in this way.",
- :arg_arity => [1,-1]
+ :arg_arity => [1, -1]
option :diff,
:long => "--[no-]diff",
@@ -264,4 +264,3 @@ class Chef
end
end
end
-