summaryrefslogtreecommitdiff
path: root/lib/chef/knife
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-03-04 11:13:26 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-03-04 11:13:26 -0800
commit6ec521c0b86c266b9dd5d17a6060139dab404c3b (patch)
treea27bf7a007bfeebd64258c2e5652f6da37b73efc /lib/chef/knife
parentee53ee1aba16ee2ad7c1fdde18869af971dcba67 (diff)
parent4fd88f1f3c7d847712e61abab2bac6cb4a987265 (diff)
downloadchef-6ec521c0b86c266b9dd5d17a6060139dab404c3b.tar.gz
Merge pull request #4617 from chef/lcg/chefstyle-perf
Autofixing new Perf cops in 0.37.2
Diffstat (limited to 'lib/chef/knife')
-rw-r--r--lib/chef/knife/cookbook_site_download.rb2
-rw-r--r--lib/chef/knife/cookbook_site_show.rb2
-rw-r--r--lib/chef/knife/core/bootstrap_context.rb5
-rw-r--r--lib/chef/knife/core/subcommand_loader.rb2
-rw-r--r--lib/chef/knife/search.rb2
-rw-r--r--lib/chef/knife/ssh.rb2
6 files changed, 8 insertions, 7 deletions
diff --git a/lib/chef/knife/cookbook_site_download.rb b/lib/chef/knife/cookbook_site_download.rb
index 2bdeea9781..21a251a011 100644
--- a/lib/chef/knife/cookbook_site_download.rb
+++ b/lib/chef/knife/cookbook_site_download.rb
@@ -102,7 +102,7 @@ class Chef
end
def specific_cookbook_version_url
- "#{cookbooks_api_url}/#{@name_args[0]}/versions/#{@name_args[1].gsub('.', '_')}"
+ "#{cookbooks_api_url}/#{@name_args[0]}/versions/#{@name_args[1].tr('.', '_')}"
end
end
end
diff --git a/lib/chef/knife/cookbook_site_show.rb b/lib/chef/knife/cookbook_site_show.rb
index a6a4c82c85..c0280cb318 100644
--- a/lib/chef/knife/cookbook_site_show.rb
+++ b/lib/chef/knife/cookbook_site_show.rb
@@ -33,7 +33,7 @@ class Chef
when 1
noauth_rest.get("https://supermarket.chef.io/api/v1/cookbooks/#{@name_args[0]}")
when 2
- noauth_rest.get("https://supermarket.chef.io/api/v1/cookbooks/#{@name_args[0]}/versions/#{name_args[1].gsub('.', '_')}")
+ noauth_rest.get("https://supermarket.chef.io/api/v1/cookbooks/#{@name_args[0]}/versions/#{name_args[1].tr('.', '_')}")
end
end
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb
index 7ad70bc627..d96e07c03c 100644
--- a/lib/chef/knife/core/bootstrap_context.rb
+++ b/lib/chef/knife/core/bootstrap_context.rb
@@ -182,9 +182,10 @@ CONFIG
def first_boot
(@config[:first_boot_attributes] || {}).tap do |attributes|
if @config[:policy_name] && @config[:policy_group]
- attributes.merge!(:policy_name => @config[:policy_name], :policy_group => @config[:policy_group])
+ attributes[:policy_name] = @config[:policy_name]
+ attributes[:policy_group] = @config[:policy_group]
else
- attributes.merge!(:run_list => @run_list)
+ attributes[:run_list] = @run_list
end
attributes.merge!(:tags => @config[:tags]) if @config[:tags] && !@config[:tags].empty?
diff --git a/lib/chef/knife/core/subcommand_loader.rb b/lib/chef/knife/core/subcommand_loader.rb
index dc0b0cc39c..72329d8b95 100644
--- a/lib/chef/knife/core/subcommand_loader.rb
+++ b/lib/chef/knife/core/subcommand_loader.rb
@@ -124,7 +124,7 @@ class Chef
load_command(cmd_words)
result = Chef::Knife.subcommands[find_longest_key(Chef::Knife.subcommands,
cmd_words, "_")]
- result || Chef::Knife.subcommands[args.first.gsub("-", "_")]
+ result || Chef::Knife.subcommands[args.first.tr("-", "_")]
end
def guess_category(args)
diff --git a/lib/chef/knife/search.rb b/lib/chef/knife/search.rb
index 30a3db3cf2..520c9273af 100644
--- a/lib/chef/knife/search.rb
+++ b/lib/chef/knife/search.rb
@@ -177,7 +177,7 @@ class Chef
# See lib/chef/search/query.rb for more examples of this.
def create_result_filter(filter_string)
final_filter = Hash.new
- filter_string.gsub!(" ", "")
+ filter_string.delete!(" ")
filters = filter_string.split(",")
filters.each do |f|
return_id, attr_path = f.split("=")
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 4184171a4e..9c0f8936f0 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -424,7 +424,7 @@ class Chef
end.join(" \\; ")
end
- tmux_name = "'knife ssh #{@name_args[0].gsub(/:/, '=')}'"
+ tmux_name = "'knife ssh #{@name_args[0].tr(':', '=')}'"
begin
server = session.servers_for.first
cmd = ["tmux new-session -d -s #{tmux_name}",