Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error raised for resources with identical aliases, but different titles #499

Closed
domcleal opened this issue Apr 10, 2017 · 1 comment

Comments

@domcleal
Copy link
Contributor

commented Apr 10, 2017

a3d3cbc (I think) introduced a regression building catalogs which contain multiple resources with different titles, but identical aliases.

exec { 'foo_bar_1':
  command => '/bin/echo foo bar',
}
exec { 'foo_bar_2':
  command => '/bin/echo foo bar',
}

rspec-puppet would add identical aliases to the catalog for the two execs, causing a duplicate and the following error:

 ArgumentError:
   Cannot alias Exec[foo_bar_2] to "/bin/echo foo bar" at spec/fixtures/modules/relationships/manifests/titles.pp:15; resource ["Exec", "/bin/echo foo bar"] already declared at spec/fixtures/modules/relationships/manifests/titles.pp:12
 # gems/puppet-4.9.4/lib/puppet/resource/catalog.rb:190:in `alias'
 # ./lib/rspec-puppet/support.rb:256:in `block in build_catalog_without_cache'
 # ./lib/rspec-puppet/support.rb:254:in `each'
 # ./lib/rspec-puppet/support.rb:254:in `build_catalog_without_cache'
 # ./lib/rspec-puppet/support.rb:268:in `block in build_catalog'
 # ./lib/rspec-puppet/cache.rb:17:in `call'
 # ./lib/rspec-puppet/cache.rb:17:in `get'
 # ./lib/rspec-puppet/support.rb:267:in `build_catalog'
 # ./lib/rspec-puppet/support.rb:31:in `block in load_catalogue'
 # ./lib/rspec-puppet/support.rb:219:in `with_vardir'
 # ./lib/rspec-puppet/support.rb:19:in `load_catalogue'
 # ./lib/rspec-puppet/example/class_example_group.rb:7:in `catalogue'
 # ./lib/rspec-puppet/support.rb:11:in `block in subject'
 # ./lib/rspec-puppet/matchers/compile.rb:23:in `call'
 # ./lib/rspec-puppet/matchers/compile.rb:23:in `matches?'
 # ./spec/classes/relationship__titles_spec.rb:6:in `block (2 levels) in <top (required)>'

This exec pattern is used in puppetlabs-postgresql here: https://github.com/puppetlabs/puppetlabs-postgresql/blob/4.9.0/manifests/server/config_entry.pp#L48-L64

Example test: https://gist.github.com/domcleal/bbee33af2d1626fa99cda972bc2dfe8f

@walkamongus

This comment has been minimized.

Copy link

commented Apr 10, 2017

👍 I just hit this error as well

@rodjek rodjek added the bug label Apr 11, 2017

@rodjek rodjek added this to the 2.6.0 milestone Apr 11, 2017

rodjek added a commit that referenced this issue Apr 11, 2017

@rodjek rodjek added the pr open label Apr 11, 2017

rodjek added a commit that referenced this issue Apr 11, 2017

@DavidS DavidS closed this in #500 Apr 11, 2017

@rodjek rodjek removed the pr open label Aug 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.