Bug #981

info message about adding aliases repeated on every run

Added by Martha Greenberg about 4 years ago. Updated over 3 years ago.

Status:Closed Start date:
Priority:Normal Due date:
Assignee:James Turnbull % Done:

0%

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

Description

Every time puppet is run, it sends an info message about adding aliases to every host with an alias. This happens even when the alias already exists, but should only happen the first time.

puppettest:~# grep example /etc/hosts
puppettest:~# puppet -v /tmp/test.pp
info: Loading fact virtual
info: Loading fact kernelversion
info: /Host[test.example.com]: Adding aliases "test"
notice: /Host[test.example.com]/ensure: created
info: Filebucket[/var/lib/puppet/clientbucket]: Adding /etc/hosts(91412413d215f23fab736c74e22ef2e4)
puppettest:~# grep example /etc/hosts
10.0.0.1        test.example.com        test
puppettest:~# puppet -v /tmp/test.pp
info: Loading fact virtual
info: Loading fact kernelversion
info: /Host[test.example.com]: Adding aliases "test"
puppettest:~# grep example /etc/hosts
10.0.0.1        test.example.com        test
puppettest:~# puppet -v /tmp/test.pp
info: Loading fact virtual
info: Loading fact kernelversion
info: /Host[test.example.com]: Adding aliases "test"
puppettest:~# cat /tmp/test.pp
host { "test.example.com" :
  ip     => "10.0.0.1",
  alias  => "test",
  ensure => present,
}

aliases.diff (795 Bytes) Martha Greenberg, 01/02/2008 05:51 pm

aliases.patch (538 Bytes) Martha Greenberg, 01/06/2008 05:01 pm

History

Updated by James Turnbull about 4 years ago

Patch is empty?

Updated by Martha Greenberg about 4 years ago

If you download the patch, you can see it, I don’t know why it doesn’t show correctly in the web interface. Here is:

—– lib/puppet/metatype/metaparams.rb 2008-01-02 18:22:41.000000000 +0200 +++ lib/puppet/metatype/metaparams.rb 2008-01-02 18:24:00.000000000 +0200 @@ -197,0 +197,0 @@

         raise(ArgumentError, "Cannot add aliases without a catalog") unless @resource.catalog

– @resource.info “Adding aliases %s” % aliases.collect { |a| a.inspect }.join(“, ”)

         aliases.each do |other|
             if obj = @resource.catalog.resource(@resource.class.name, other)
  •            @resource.info "Adding aliases %s" % aliases.collect { |a| a.inspect }.join(", ")
                 unless obj.object_id == @resource.object_id
                     self.fail("%s can not create alias %s: object already exists" % [@resource.title, other])
                 end
    

Updated by James Turnbull about 4 years ago

I can replicate this – but don’t think the patch is the right solution? Luke?

Updated by Luke Kanies about 4 years ago

Hmm, I thought I knew what the source of the problem was, but I only see the alias being added once (although I agree that the line appears twice).

I am only getting one statement when using the stand-alone puppet, fwiw.

Does this patch make both log messages go away, or just one?

Updated by Martha Greenberg about 4 years ago

With the patch I get a message on the first run, but not on the second run:

# puppet -v /tmp/test2.pp
info: Loading fact kernelversion
info: Loading fact virtual
notice: //Host[test.example.com]/ensure: created
info: Filebucket[/var/lib/puppet/clientbucket]: Adding /etc/hosts(27d8d04be9a1791c5fb6657df46efc57)
# puppet -v /tmp/test2.pp
info: Loading fact kernelversion
info: Loading fact virtual
colosseum9:~# cat /tmp/test2.pp
host { "test.example.com" :
  ip => "10.0.0.1", alias => "test", ensure => present,
}
# grep test /etc/hosts
10.0.0.1        test.example.com        test
#



Updated by David Schmitt about 4 years ago

fixed description quoting

Updated by Redmine Admin over 3 years ago

  • Status changed from 1 to Accepted

Updated by Luke Kanies over 3 years ago

  • Status changed from Accepted to Ready For Checkin
  • Assignee changed from Luke Kanies to James Turnbull
  • Target version set to 0.24.6
  • Affected Puppet version set to 0.24.4

This is a misunderstanding of the message — the ‘adding alias’ message is actually about adding aliases to the catalog, not to the hosts file.

That being said, I can see how it’s confusing, and the message isn’t actually helpful, so I’ve removed it in the tickets/0.24.x/981 branch in my repo.

Updated by James Turnbull over 3 years ago

  • Status changed from Ready For Checkin to Closed

Pushed in commit:d2c89985bb356188ac52d00b0799cae655a9c75b in branch 0.24.x

Also available in: Atom PDF