Bug #1553

Puppet and Facter cannot both install the plist module into two different locations.

Added by Nigel Kersten over 3 years ago. Updated almost 2 years ago.

Status:Closed Start date:09/04/2008
Priority:Urgent Due date:
Assignee:James Turnbull % Done:

0%

Category:-
Target version:0.24.6
Affected Puppet version:0.24.4 Branch:
Keywords:
Votes: 0

Description

The error people are likely to see is:

/Library/Ruby/Site/1.8/plist/parser.rb:67: warning: already initialized constant TEXT
/Library/Ruby/Site/1.8/plist/parser.rb:68: warning: already initialized constant XMLDECL_PATTERN
/Library/Ruby/Site/1.8/plist/parser.rb:69: warning: already initialized constant DOCTYPE_PATTERN
/Library/Ruby/Site/1.8/plist/parser.rb:70: warning: already initialized constant COMMENT_START
/Library/Ruby/Site/1.8/plist/parser.rb:71: warning: already initialized constant COMMENT_END
/Library/Ruby/Site/1.8/plist.rb:21: warning: already initialized constant VERSION
NoMethodError: undefined method ‘new’ for nil:NilClass

when running facter >= 1.5.0 with puppet.

Sample code to illustrate the problem:

#!/usr/bin/env ruby

require 'puppet/util/plist'
require 'facter/util/plist'

xml_data = %x{system_profiler -xml SPHardwareDataType}
puts Plist::parse_xml( xml_data )

will produce the above error.

I’m not sure what the long term solution here is, but I offer several alternatives:

Neither Puppet or Facter include plist, but require it to be installed separately.

Puppet does not include plist, but Facter does (given that Facter is a requirement for Puppet)

We do something hacky like this in Facter for the require statements

begin
  Plist
rescue NameError
  require 'facter/util/plist'
end

eeeeeeew.

As it stands, Facter 1.5.0 and higher are broken when used with Puppet on Mac OS X until this is resolved.

Of the three options above, I think the second is the most palatable long term, but requires changes to Puppet. The first option is probably the most ‘correct’ option, given some users may in fact install plist themselves and try to use in Facter facts or Puppet plugins, but adds an annoying barrier to entry for getting Puppet/Facter installed on Mac OS X.

I don’t mind packaging plist up with Facter and Puppet on Mac OS X in a single metapackage if that’s the best solution everyone agrees on.

0001-Fixes-1553-Puppet-and-Facter-cannot-both-install-t.patch (16.5 kB) Nigel Kersten, 09/05/2008 07:48 pm

History

Updated by James Turnbull over 3 years ago

  • Category set to binary
  • Status changed from Unreviewed to Accepted
  • Assignee set to Luke Kanies
  • Target version set to 1.5.2

Updated by James Turnbull over 3 years ago

  • Priority changed from Normal to Urgent

Updated by James Turnbull over 3 years ago

Option #2 looks like the right solution to me. Who volunteers a patch?

Updated by Nigel Kersten over 3 years ago

I’m perfectly willing to submit a patch that removes puppet/util/plist and changes all references to instead be facter/util/plist.

However this does concern me a little due to forcing users to upgrade to Facter 1.5 to use the newer Puppet client. Perhaps if I modify install.rb to check for the version of Facter as well in the same patch? Does that seem acceptable?

Updated by Nigel Kersten over 3 years ago

Here’s the patch, including a check of the version of Facter that is installed.

I couldn’t find a generic way of querying Ruby modules to work out what version they are, so didn’t extend this so we can specify versions of all the prerequisites.

Trying to follow the development guide rather than using github with this patch. Let me know if this works better for you. Patched against 0.24.x

Updated by James Turnbull over 3 years ago

  • Project changed from Facter to Puppet
  • Category deleted (binary)
  • Target version deleted (1.5.2)

Updated by Luke Kanies over 3 years ago

  • Assignee changed from Luke Kanies to James Turnbull
  • Target version set to 0.24.6

Reassigning to James, since it’s a patch for stable.

Updated by James Turnbull over 3 years ago

  • Status changed from Accepted to Closed

Pushed in commit:a7306e14b9aa064218d051602715c987aebb8417 in branch 0.24.x

Also available in: Atom PDF