diff options
author | danielsdeleo <dan@chef.io> | 2015-06-30 08:52:35 -0700 |
---|---|---|
committer | danielsdeleo <dan@chef.io> | 2015-06-30 09:39:58 -0700 |
commit | 20cc6233a8ff8c1cc92670a56ee17a6bb8692e0f (patch) | |
tree | 710ea6a9523fe77dfd0e65e17030c97ab7119352 | |
parent | 14c869c4144282d5c6f329eabaefa302aece2d92 (diff) | |
download | chef-20cc6233a8ff8c1cc92670a56ee17a6bb8692e0f.tar.gz |
Don't mutate recipe name string in versioned_recipe_list
fixes #3618
-rw-r--r-- | lib/chef/run_list/versioned_recipe_list.rb | 11 | ||||
-rw-r--r-- | spec/unit/run_list/versioned_recipe_list_spec.rb | 2 |
2 files changed, 6 insertions, 7 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 diff --git a/spec/unit/run_list/versioned_recipe_list_spec.rb b/spec/unit/run_list/versioned_recipe_list_spec.rb index d87d7a409c..9c3ecaa0dd 100644 --- a/spec/unit/run_list/versioned_recipe_list_spec.rb +++ b/spec/unit/run_list/versioned_recipe_list_spec.rb @@ -180,8 +180,6 @@ describe Chef::RunList::VersionedRecipeList do end it "does not mutate the recipe name" do - pending "This reproduces https://github.com/chef/chef/issues/3618" - expect(fq_names).to eq([ "apt::cacher@~> 1.2.0" ]) expect(list).to eq( [ "apt::cacher" ] ) end |