Bug #2987

host resource fails with alias and not yet present entry

Added by Peter Meier 7 months ago. Updated 3 months ago.

Status:Closed Start:12/25/2009
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:Doh!
Target version:0.25.2
Affected version:0.25.2rc2 Branch:http://github.com/duritong/puppet/tree/ticket/0.25.x/2987
Keywords:
Votes: 1

Description

Given the following manifest:

-bash-3.2# cat foo.pp 
    host{
        'foo.bar.ch':
            host_aliases => [ 'foo', 'ifoor.bar.ch' ],
            ip => '192.168.1.81';
    }

and that no such entry is yet present, the host alias will fail with the following error:

-bash-3.2# puppet --trace foo.pp
notice: //Host[foo.bar.ch]/ensure: created
/usr/lib/ruby/site_ruby/1.8/puppet/provider/host/parsed.rb:66:in `to_line'
/usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in `to_file'
/usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in `collect'
/usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in `to_file'
/usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:316:in `to_file'
/usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:102:in `flush_target'
/usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:74:in `flush'
/usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:72:in `each'
/usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:72:in `flush'
/usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:356:in `flush'
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:752:in `flush'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:94:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:251:in `eval_children_and_apply_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:389:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:388:in `thinmark'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:250:in `eval_children_and_apply_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:207:in `eval_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:296:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:389:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:388:in `thinmark'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:295:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in `collect'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:142:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/application/puppet.rb:128:in `main'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `send'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:306:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'
/usr/bin/puppet:71
err: Got an uncaught exception of type ArgumentError: Host aliases must be specified as an array

It looks like while migrating to @host_aliases@ something got missed. There is no such problem if the entry already exists. Patch is sent soon.

History

Updated by Peter Meier 7 months ago

  • Status changed from Unreviewed to Ready for Testing
  • Branch set to http://github.com/duritong/puppet/tree/ticket/0.25.x/2987

patch sent to the list

Updated by James Turnbull 7 months ago

  • Category set to Doh!
  • Status changed from Ready for Testing to Closed

Pushed in commit:“4d815117672a6f27ff368c9485edb4edf49e63aa” in branch 0.25.x

Updated by Peter Couvares 7 months ago

I ran into this error as well. However, although this patch suppresses the error, and the /etc/hosts file is created with entries for each configured hostname, the host aliases are not added as they should be.

Updated by Peter Meier 7 months ago

I ran into this error as well. However, although this patch suppresses the error, and the /etc/hosts file is created with entries for each configured hostname, the host aliases are not added as they should be.

I just did various tests and it works for me in all possible variations. Did you apply the patch on the server AND the client?

Updated by Peter Couvares 7 months ago

In this case the server and client are the same host, so yes.

The hosts file creation is otherwise working: /etc/hosts is correctly repopulated (sans aliases) if I nuke any puppet-managed lines. Without the patch, no host lines are added; I only see the log error you reported above. My host entries are of the form:

host { "host1.redacted.com":
        ensure => present,
        ip => "192.168.1.10",
        alias => [ "host1", "alias1" ],
}

And I see the usual in the log: @@Dec 28 21:47:28 server1 puppetd[6218]: (//Host[host1.redacted.com]/ensure) created@@

Updated by Peter Meier 7 months ago

And I see the usual in the log: @@Dec 28 21:47:28 server1 puppetd[6218]: (//Host[host1.redacted.com]/ensure) created@@

you should now use host_alias for host aliases. alias is the puppet metaparameter. This is the actual change from 0.25.1 to 0.25.2. For further information have a look at #2813

Updated by Peter Couvares 7 months ago

Ah — thank you! My apologies for the false report.

For future reference, was this metaparameter name change documented somewhere obvious that I should have noticed (other than your example code at the top of this ticket), or it just the kind of thing anyone running the release candidate is expected to figure out on their own by reviewing all the post-0.24.x changes in detail? If I failed to read something that I should have, I’d like to know. Thanks again.

Updated by Peter Meier 7 months ago

For future reference, was this metaparameter name change documented somewhere obvious that I should have noticed (other than your example code at the top of this ticket), or it just the kind of thing anyone running the release candidate is expected to figure out on their own by reviewing all the post-0.24.x changes in detail? If I failed to read something that I should have, I’d like to know. Thanks again.

it should get into the release notes, maybe it got lost for the RC, James?

Updated by James Turnbull 7 months ago

It did indeed get lost. I’ll make sure it makes it into the final release notes. Apologies for the trouble.

Also available in: Atom PDF