Bug #16006

Undefined method `downcase' for nil:NilClass when calling puppet validate on a host without hostname

Added by Lukáš Zapletal 10 months ago. Updated 10 months ago.

Status:ClosedStart date:08/17/2012
Priority:LowDue date:
Assignee:Lukáš Zapletal% Done:

0%

Category:SSL
Target version:-
Affected Puppet version:2.7.18 Branch:
Keywords:

Description

Version: puppet-2.7.18-1.fc17.noarch

How to reproduce:

1) Have a machine without hostname set 2) Try to call puppet parser validate some-file.pp 3) /usr/share/ruby/vendor_ruby/puppet/defaults.rb:225:in <module:Puppet>': undefined methoddowncase' for nil:NilClass (NoMethodError)

    from /usr/share/ruby/vendor_ruby/puppet/defaults.rb:2:in `<top (required)>'

This bit has the bug:

hostname = Facter["hostname"].value
domain = Facter["domain"].value
if domain and domain != ""
fqdn = [hostname, domain].join(".")
else
fqdn = hostname
end
Puppet.setdefaults(
:main,
# We have to downcase the fqdn, because the current ssl stuff (as oppsed to in master) doesn't have good facilities for
# manipulating naming.
:certname => {:default => fqdn.downcase, :desc => "The name to use when handling certificates.  Defaults
to the fully qualified domain name.",
:call_on_define => true, # Call our hook with the default value, so we're always downcased
:hook => proc { |value| raise(ArgumentError, "Certificate names must be lower case; see #1168") unless value == value.downcase }},
:certdnsnames => {
:default => '',
:hook    => proc do |value|

I dont see this in master. Can you please confirm me this was fixed upstream? Thanks

https://github.com/puppetlabs/puppet/blob/master/lib/puppet/defaults.rb


Related issues

Related to Puppet - Refactor #18569: Implement "whiny nil" for Puppet, solve `Undefined method... Rejected

History

#1 Updated by Lukáš Zapletal 10 months ago

Sorry about the formatting, I am not able to edit it (dont know how :–)

#2 Updated by eric sorenson 10 months ago

  • Status changed from Unreviewed to Needs More Information
  • Assignee set to Lukáš Zapletal

How did you get a machine without a hostname?

How can I reproduce the problem?

#3 Updated by Lukáš Zapletal 10 months ago

In Fedora Build system (Koji) builders are working in a fake build root without any hostname set, or at least that’s our team’s case.

If you think this is fixed in master, please close.

#4 Updated by Lukáš Zapletal 10 months ago

This could work:

FACTER_hostname= puppet parser validate xxx.pp

#5 Updated by eric sorenson 10 months ago

  • Status changed from Needs More Information to Closed

Yes this works in master.

[eric@glitch.local ~/Sandbox]% FACTER_hostname= puppet apply ./array-15628.pp   
Real default1
Real default2
New value1
New value2
/Stage[main]//My::Define[array_override]/Notify[array_override]/message: defined 'message' as 'Real default1
Real default2
New value1
New value2'

Also available in: Atom PDF