Re: [Puppet Users] Why second apt key receives again and again and again?

720 views
Skip to first unread message

Matthaus Owens

unread,
Oct 12, 2012, 1:50:15 PM10/12/12
to puppet...@googlegroups.com
The unless for the apt::key exec uses `apt-key list` and greps for the
key name you gave the resource. apt-key prints out the shorter name
for the key in the case of 3B4FE6ACC0B21F32, so the grep never finds
the long name.

Apt-key list for me shows

pub 4096R/C0B21F32 2012-05-11
uid Ubuntu Archive Automatic Signing Key (2012)
<ftpm...@ubuntu.com>


`apt-key list | grep 3B4FE6ACC0B21F32` returns 1, so the unless fails,
and the exec runs again and again.

If you use the shorter name (C0B21F32) as the name of your apt::key
resource, the unless should correctly detect the key as being present.

HTH

On Thu, Oct 11, 2012 at 5:59 PM, Anton Markelov <dou...@gmail.com> wrote:
> Hello, all.
>
> A have a manifest:
>
>>>
>>> #key.pp - puppet::key class provides a keys for the puppetlabs repos with
>>> apt::key
>>>
>>> class puppet::key{
>>>
>>>
>>> apt::key { "01puppetlabs":
>>>
>>> key => "4BD6EC30",
>>>
>>> key_options =>
>>> "http-proxy=\"http://keyp...@proxy.localnet:3128\"",
>>>
>>> key_server => "keys.gnupg.net",
>>>
>>> }
>>>
>>>
>>> apt::key { "02puppetlabs":
>>>
>>> key => "3B4FE6ACC0B21F32",
>>>
>>> key_options =>
>>> "http-proxy=\"http://keyp...@proxy.localnet:3128\"",
>>>
>>> key_server => "keys.gnupg.net",
>>>
>>> }
>>>
>>> }
>
>
> Apt::key class provided with puppetlabs-apt module with little additions
> (see https://github.com/strangeman/puppetlabs-apt, commit
> https://github.com/strangeman/puppetlabs-apt/commit/00155ccf1b2486e1a17e3b9f579c6e715fc06ccd)
> First key (01puppetlabs) received 1 times, and all is good. But second key
> (02puppetlabs) recieves again and again and I don't now, why.
>>>
>>> root@testpuppet:/etc/puppet# puppet agent --test
>>>
>>> Info: Retrieving plugin
>>>
>>> Info: Loading facts in
>>> /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
>>>
>>> Info: Loading facts in
>>> /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
>>>
>>> Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
>>>
>>> Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
>>>
>>> Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
>>>
>>> Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
>>>
>>> Info: Caching catalog for testpuppet.localnet
>>>
>>> Info: Applying configuration version '1350002030'
>>>
>>>
>>> /Stage[first]/Puppet::Key/Apt::Key[02puppetlabs]/Exec[f4d6b744eb08aa083379d78e9b95b84493d4b2fe]/returns:
>>> executed successfully
>>>
>>> Finished catalog run in 2.40 seconds
>>>
>>> root@testpuppet:/etc/puppet# puppet agent --test
>>>
>>> Info: Retrieving plugin
>>>
>>> Info: Loading facts in
>>> /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
>>>
>>> Info: Loading facts in
>>> /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
>>>
>>> Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
>>>
>>> Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
>>>
>>> Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
>>>
>>> Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
>>>
>>> Info: Caching catalog for testpuppet.localnet
>>>
>>> Info: Applying configuration version '1350002030'
>>>
>>>
>>> /Stage[first]/Puppet::Key/Apt::Key[02puppetlabs]/Exec[f4d6b744eb08aa083379d78e9b95b84493d4b2fe]/returns:
>>> executed successfully
>>>
>>> Finished catalog run in 2.05 seconds
>>>
>>> root@testpuppet:/etc/puppet# puppet agent --test
>>>
>>> Info: Retrieving plugin
>>>
>>> Info: Loading facts in
>>> /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
>>>
>>> Info: Loading facts in
>>> /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
>>>
>>> Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
>>>
>>> Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
>>>
>>> Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
>>>
>>> Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
>>>
>>> Info: Caching catalog for testpuppet.localnet
>>>
>>> Info: Applying configuration version '1350002030'
>>>
>>>
>>> /Stage[first]/Puppet::Key/Apt::Key[02puppetlabs]/Exec[f4d6b744eb08aa083379d78e9b95b84493d4b2fe]/returns:
>>> executed successfully
>>>
>>> Finished catalog run in 2.05 seconds
>>
>>
>
> Puppet version: 3.0.0-1puppetlabs1 (same for agent and master), OS: Debian 6
> and Ubuntu 12.04.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/G1lqkC0tAogJ.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.



--
Matthaus Owens
Release Manager, Puppet Labs

Anton Markelov

unread,
Oct 12, 2012, 6:25:31 PM10/12/12
to puppet...@googlegroups.com
Oh. Thanks a lot, it helps for me.
Reply all
Reply to author
Forward
0 new messages