summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2015-06-30 08:52:35 -0700
committerdanielsdeleo <dan@chef.io>2015-06-30 09:39:58 -0700
commit20cc6233a8ff8c1cc92670a56ee17a6bb8692e0f (patch)
tree710ea6a9523fe77dfd0e65e17030c97ab7119352 /lib
parent14c869c4144282d5c6f329eabaefa302aece2d92 (diff)
downloadchef-20cc6233a8ff8c1cc92670a56ee17a6bb8692e0f.tar.gz
Don't mutate recipe name string in versioned_recipe_list
fixes #3618
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/run_list/versioned_recipe_list.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/chef/run_list/versioned_recipe_list.rb b/lib/chef/run_list/versioned_recipe_list.rb
index 7cce6fa48c..2824f08f31 100644
--- a/lib/chef/run_list/versioned_recipe_list.rb
+++ b/lib/chef/run_list/versioned_recipe_list.rb
@@ -70,15 +70,16 @@ class Chef
# @return [Array] Array of strings with fully-qualified recipe names
def with_fully_qualified_names_and_version_constraints
self.map do |recipe_name|
- ret = if recipe_name.include?('::')
+ qualified_recipe = if recipe_name.include?('::')
recipe_name
else
"#{recipe_name}::default"
end
- if @versions[recipe_name]
- ret << "@#{@versions[recipe_name]}"
- end
- ret
+
+ version = @versions[recipe_name]
+ qualified_recipe = "#{qualified_recipe}@#{version}" if version
+
+ qualified_recipe
end
end
end