Ask Your Question
1

How to get around duplicate definition errors?

asked 2013-08-30 02:02:27 -0500

nibalizer gravatar image

I'd like to have the sqlite gem installed, which depends on the sqlite package. So I end up with

package { 'sqlite3':
   ensure => present,
}
package { 'sqlite3':
   ensure => present,
   provider => 'gem',
   require => Package['sqlite3'],
}

Is there any way to resolve this? Maybe set the namevar differently on one? I'm pretty sure I can solve this problem by installing the ruby-sqlite3 package from my distribution, but that won't always work, not by a long shot.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
3

answered 2013-08-30 10:55:18 -0500

GregLarkin gravatar image

updated 2013-08-30 12:31:06 -0500

Unfortunately, this is a 5 year old bug. The only workarounds that I've read about it use an exec to install one of the packages instead of a package resource.

edit flag offensive delete link more

Comments

Awesome. Okay well I've +1'd the composite namevar suggestion.

nibalizer gravatar imagenibalizer ( 2013-08-30 12:16:54 -0500 )edit
0

answered 2013-08-31 20:46:42 -0500

Willi gravatar image

updated 2013-08-31 20:48:11 -0500

isn't that a scoping issue?

im pretty new to puppet...but according to the book 'pro puppet' the problem here is that the puppet language has no correct order cause its declarative....the only way to not end up in an infinite loop here (require => Package['sqlite3']) is to through an exception/error

as you already mentioned ... i think this could solve this issue, too:

package { 'sqlite3_package':
  name => sqlite3, 
  ensure => present,
}
package { 'sqlite3':
   ensure => present,
   provider => 'gem',
   require => Package['sqlite3_package'],
}
edit flag offensive delete link more

Comments

the problem with your solution would be the same conflict, because $name = $title Puppet uses the title and name/namevar to identify duplicate resources — if either of these is duplicated ...(more)

golja gravatar imagegolja ( 2013-09-01 03:34:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-08-30 02:02:27 -0500

Seen: 252 times

Last updated: Aug 31 '13