summaryrefslogtreecommitdiff
path: root/lib/chef/knife
diff options
context:
space:
mode:
authorJulian C. Dunn <jdunn@opscode.com>2013-04-30 01:38:22 -0400
committerBryan McLellan <btm@opscode.com>2013-06-18 10:40:30 -0700
commit6bd4f732c6651e4ac38e7069030929f226c8cc51 (patch)
tree07436a2d7ca8d811bbac48a8d860a03b406f4479 /lib/chef/knife
parenta0a59852283a3cacd23791e1f86fc6b7634b0035 (diff)
downloadchef-6bd4f732c6651e4ac38e7069030929f226c8cc51.tar.gz
CHEF-4022 Remove local variable from determine_version due to memoization as noted by @danielsdeleo
Diffstat (limited to 'lib/chef/knife')
-rw-r--r--lib/chef/knife/cookbook_download.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/chef/knife/cookbook_download.rb b/lib/chef/knife/cookbook_download.rb
index 928fd9b857..89530a6cf7 100644
--- a/lib/chef/knife/cookbook_download.rb
+++ b/lib/chef/knife/cookbook_download.rb
@@ -99,14 +99,13 @@ class Chef
end
def determine_version
- versions = available_versions
- if versions.nil?
+ if available_versions.nil?
nil
- elsif versions.size == 1
- @version = versions.first
+ elsif available_versions.size == 1
+ @version = available_versions.first
elsif config[:latest]
- @version = versions.map { |v| Chef::Version.new(v) }.sort.last
+ @version = available_versions.map { |v| Chef::Version.new(v) }.sort.last
else
ask_which_version
end