Bug #3354

puppet/util/settings/file_setting.rb should internalize strings when checking for AllowedOwners and AllowedGroups

Added by David Schmitt about 2 years ago. Updated 4 months ago.

Status:Closed Start date:03/09/2010
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:settings
Target version:-
Affected Puppet version:0.25.4 Branch:
Keywords:
Votes: 0

Description

On Debian’s 0.25.4-2~bpo50+1, the following fails:

config = Puppet::Util::Settings.new
config.setdefaults(:reports, :basedir => {:default => @hostdir, :owner => :service, :mode => 0755, :desc => "munin report hack"})

with this error:

.....: Internal error: The :owner setting for ...: basedir must be either 'root' or 'service', not 'service'

But this works:

config = Puppet::Util::Settings.new
config.setdefaults(:reports, :basedir => {:default => @hostdir, :owner => 'service', :mode => 0755, :desc => "munin report hack"})

The only difference is ‘service’ instead of :service.

The error occurs in puppet/util/settings/file_setting.rb:

AllowedOwners = %w{root service}
...
    unless AllowedOwners.include?(value)

Here’s the stacktrace starting from my code:

/usr/lib/ruby/1.8/puppet/util/settings/file_setting.rb:33:in `owner='
/usr/lib/ruby/1.8/puppet/util/settings/setting.rb:44:in `send'
/usr/lib/ruby/1.8/puppet/util/settings/setting.rb:44:in `initialize'
/usr/lib/ruby/1.8/puppet/util/settings/setting.rb:38:in `each'
/usr/lib/ruby/1.8/puppet/util/settings/setting.rb:38:in `initialize'
/usr/lib/ruby/1.8/puppet/util/settings.rb:405:in `new'
/usr/lib/ruby/1.8/puppet/util/settings.rb:405:in `newsetting'
/usr/lib/ruby/1.8/puppet/util/settings.rb:538:in `setdefaults'
/usr/lib/ruby/1.8/puppet/util/settings.rb:523:in `each'
/usr/lib/ruby/1.8/puppet/util/settings.rb:523:in `setdefaults'

I’d suggest internalizing both the Allowed* arrays and the incoming value.

History

Updated by David Schmitt about 2 years ago

P.S.: I believe this worked on 0.24 without an error

Updated by James Turnbull about 2 years ago

  • Status changed from Unreviewed to Accepted
  • Assignee set to Markus Roberts

Updated by Joshua Lifton 5 months ago

  • Assignee deleted (Markus Roberts)

This issue was assigned to a former Puppet Labs employee. Adding back to the pool of unreviewed issues.

Updated by Joshua Lifton 5 months ago

This issue was assigned to a former Puppet Labs employee. Adding back to the pool of unreviewed issues.

Updated by Ben Hughes 4 months ago

  • Description updated (diff)
  • Status changed from Accepted to Unreviewed

Updated by Daniel Pittman 4 months ago

  • Description updated (diff)
  • Status changed from Unreviewed to Closed

Also available in: Atom PDF