Brice Figureau
2008-Jul-30 15:39 UTC
[Puppet Users] Exported/Collect resource not working?
Hi, I''m running debianized puppet 0.24.4-8 (both puppetmaster and puppets). I''m having issues with exported/collected resources. I have two nodes corp1 and corp2, each are using the following manifest from the module test: modules_dir { ["test","test/test.d"]: } class test { concatenated_file { "/var/lib/puppet/modules/test/test.txt": dir => "/var/lib/puppet/modules/test/test.d"; } @@concatenated_file_part { "${fqdn}-part": dir => "/var/lib/puppet/modules/test/test.d", tag => "test"; } Concatenated_file_part <<| tag == ''test'' |>> } concatenated_file is David Schmitt''s define to build-up files by concatenating subfiles. The concatenated_file_part is basically a wrapper around file{} which notifies the exec which does the concatenation. then in site.pp: node "corp1" inherits "server" { ... various other definition... include test } node "corp2" inherits "server" { ... same various other definition... include test } Starting with a fresh database (ie corp1 and corp2 cleanly removed with kill_node_in_storedconfig.rb). Then I run manually puppet on corp1. It creates the /var/lib/puppet/modules/test/test.d/corp1-part file without any issues. The database is also populated with exported entries: | 20452 | /var/lib/puppet/modules/test/test.d/corp1-part | File | 11 | 2 | 1 | 99 | 2008-07-30 16:30:17 | | 20501 | corp1-part | Concatenated_file_part | 11 | 46 | 1 | 14 | 2008-07-30 16:30:19 | Next, doing the same thing on corp2, it creates /var/lib/puppet/modules/test/test.d/corp1-part but not /var/lib/puppet/modules/test/test.d/corp2-part (notice the corp2/corp1 mismatch). The corp1-part could come from the collected resource, but why doesn''t it create the corp2-part? I suspect puppet for an unknown reason thinks it is the same resource even though its title is different. Note that the database contains the right resources for this host: | 20812 | corp2-part | Concatenated_file_part | 12 | 46 | 1 | 14 | 2008-07-30 16:34:32 | | 20841 | /var/lib/puppet/modules/test/test.d/corp2-part | File | 12 | 2 | 1 | 99 | 2008-07-30 16:34:32 | OK, back to corp1, and re-running puppet (with the hope the corp2-part will be collected) I get the following error: err: Could not retrieve catalog: Puppet::Parser::AST::Resource failed with error ArgumentError: Duplicate definition: File[/var/lib/puppet/modules/test/test.d/corp2-part] is already defined; cannot redefine at /etc/puppet/modules/common/manifests/defines/concatenated_file.pp:99 on node corp1.daysofwonder.com Here is the full stack trace printed on the puppetmaster: /usr/lib/ruby/1.8/puppet/node/catalog.rb:466:in `fail_unless_unique'' /usr/lib/ruby/1.8/puppet/node/catalog.rb:67:in `add_resource'' /usr/lib/ruby/1.8/puppet/node/catalog.rb:62:in `each'' /usr/lib/ruby/1.8/puppet/node/catalog.rb:62:in `add_resource'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:35:in `add_resource'' /usr/lib/ruby/1.8/puppet/parser/ast/resource.rb:54:in `evaluate'' /usr/lib/ruby/1.8/puppet/util/errors.rb:25:in `exceptwrap'' /usr/lib/ruby/1.8/puppet/parser/ast/resource.rb:31:in `evaluate'' /usr/lib/ruby/1.8/puppet/parser/ast/resource.rb:30:in `collect'' /usr/lib/ruby/1.8/puppet/parser/ast/resource.rb:30:in `evaluate'' /usr/lib/ruby/1.8/puppet/parser/ast.rb:54:in `safeevaluate'' /usr/lib/ruby/1.8/puppet/parser/ast/astarray.rb:35:in `evaluate'' /usr/lib/ruby/1.8/puppet/parser/ast/astarray.rb:34:in `collect'' /usr/lib/ruby/1.8/puppet/parser/ast/astarray.rb:34:in `evaluate'' /usr/lib/ruby/1.8/puppet/parser/ast.rb:54:in `safeevaluate'' /usr/lib/ruby/1.8/puppet/parser/ast/definition.rb:44:in `evaluate_code'' /usr/lib/ruby/1.8/puppet/parser/resource.rb:61:in `evaluate'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:272:in `evaluate_definitions'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:270:in `each'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:270:in `evaluate_definitions'' /usr/lib/ruby/1.8/puppet/util/errors.rb:25:in `exceptwrap'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:267:in `evaluate_definitions'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:295:in `evaluate_generators'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:290:in `loop'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:290:in `evaluate_generators'' /usr/lib/ruby/1.8/puppet/parser/compiler.rb:92:in `compile'' /usr/lib/ruby/1.8/puppet/parser/interpreter.rb:29:in `compile'' /usr/lib/ruby/1.8/puppet/network/handler/configuration.rb:107:in `compile'' /usr/lib/ruby/1.8/puppet/util.rb:217:in `benchmark'' /usr/lib/ruby/1.8/puppet/network/handler/configuration.rb:105:in `compile'' /usr/lib/ruby/1.8/puppet/network/handler/configuration.rb:40:in `configuration'' /usr/lib/ruby/1.8/puppet/network/handler/master.rb:69:in `getconfig'' /usr/lib/ruby/1.8/puppet/util.rb:212:in `benchmark'' /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'' /usr/lib/ruby/1.8/puppet/util.rb:211:in `benchmark'' /usr/lib/ruby/1.8/puppet/network/handler/master.rb:68:in `getconfig'' /usr/share/rails/activerecord/lib/../../activesupport/lib/active_support/inflector.rb:257:in `to_proc'' /usr/lib/ruby/1.8/puppet/network/xmlrpc/processor.rb:52:in `call'' /usr/lib/ruby/1.8/puppet/network/xmlrpc/processor.rb:52:in `protect_service'' /usr/lib/ruby/1.8/puppet/network/xmlrpc/processor.rb:85:in `setup_processor'' /usr/lib/ruby/1.8/xmlrpc/server.rb:336:in `call'' /usr/lib/ruby/1.8/xmlrpc/server.rb:336:in `dispatch'' /usr/lib/ruby/1.8/xmlrpc/server.rb:323:in `each'' /usr/lib/ruby/1.8/xmlrpc/server.rb:323:in `dispatch'' /usr/lib/ruby/1.8/xmlrpc/server.rb:366:in `call_method'' /usr/lib/ruby/1.8/xmlrpc/server.rb:378:in `handle'' /usr/lib/ruby/1.8/puppet/network/xmlrpc/processor.rb:44:in `process'' /usr/lib/ruby/1.8/puppet/network/xmlrpc/webrick_servlet.rb:68:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'' /usr/lib/ruby/1.8/puppet.rb:336:in `start'' /usr/lib/ruby/1.8/puppet.rb:187:in `newthread'' /usr/lib/ruby/1.8/puppet.rb:186:in `initialize'' /usr/lib/ruby/1.8/puppet.rb:186:in `new'' /usr/lib/ruby/1.8/puppet.rb:186:in `newthread'' /usr/lib/ruby/1.8/puppet.rb:334:in `start'' /usr/lib/ruby/1.8/puppet.rb:333:in `each'' /usr/lib/ruby/1.8/puppet.rb:333:in `start'' /usr/sbin/puppetmasterd:284 /usr/lib/ruby/1.8/puppet/parser/interpreter.rb:32:in `compile'' /usr/lib/ruby/1.8/puppet/network/handler/configuration.rb:107:in `compile'' /usr/lib/ruby/1.8/puppet/util.rb:217:in `benchmark'' /usr/lib/ruby/1.8/puppet/network/handler/configuration.rb:105:in `compile'' /usr/lib/ruby/1.8/puppet/network/handler/configuration.rb:40:in `configuration'' /usr/lib/ruby/1.8/puppet/network/handler/master.rb:69:in `getconfig'' /usr/lib/ruby/1.8/puppet/util.rb:212:in `benchmark'' /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'' /usr/lib/ruby/1.8/puppet/util.rb:211:in `benchmark'' /usr/lib/ruby/1.8/puppet/network/handler/master.rb:68:in `getconfig'' /usr/share/rails/activerecord/lib/../../activesupport/lib/active_support/inflector.rb:257:in `to_proc'' /usr/lib/ruby/1.8/puppet/network/xmlrpc/processor.rb:52:in `call'' /usr/lib/ruby/1.8/puppet/network/xmlrpc/processor.rb:52:in `protect_service'' /usr/lib/ruby/1.8/puppet/network/xmlrpc/processor.rb:85:in `setup_processor'' /usr/lib/ruby/1.8/xmlrpc/server.rb:336:in `call'' /usr/lib/ruby/1.8/xmlrpc/server.rb:336:in `dispatch'' /usr/lib/ruby/1.8/xmlrpc/server.rb:323:in `each'' /usr/lib/ruby/1.8/xmlrpc/server.rb:323:in `dispatch'' /usr/lib/ruby/1.8/xmlrpc/server.rb:366:in `call_method'' /usr/lib/ruby/1.8/xmlrpc/server.rb:378:in `handle'' /usr/lib/ruby/1.8/puppet/network/xmlrpc/processor.rb:44:in `process'' /usr/lib/ruby/1.8/puppet/network/xmlrpc/webrick_servlet.rb:68:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'' /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'' /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'' /usr/lib/ruby/1.8/puppet.rb:336:in `start'' /usr/lib/ruby/1.8/puppet.rb:187:in `newthread'' /usr/lib/ruby/1.8/puppet.rb:186:in `initialize'' /usr/lib/ruby/1.8/puppet.rb:186:in `new'' /usr/lib/ruby/1.8/puppet.rb:186:in `newthread'' /usr/lib/ruby/1.8/puppet.rb:334:in `start'' /usr/lib/ruby/1.8/puppet.rb:333:in `each'' /usr/lib/ruby/1.8/puppet.rb:333:in `start'' /usr/sbin/puppetmasterd:284 I changed the ${fqdn} in the exported resource title to something not as dynamic (ie a fixed string defined in the node definition), but this does the exact same thing. I also tried to collect File instead of Concatenated_file_part, but then it doesn''t collect anything anywhere. The bad news is that I''m relying on this pattern for lots of thing, so that could be great if it works (even with a workaround). Hum, what''s wrong? Any idea or work-around? -- Brice Figureau <brice-puppet@daysofwonder.com> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Brice Figureau
2008-Jul-31 11:50 UTC
[Puppet Users] Re: Exported/Collect resource not working?
Hi, It''s not in my habit to reply to myself, but I clearly think collected resources are not working anymore in 0.24.x (including 0.24.5). On Wed, 2008-07-30 at 17:39 +0200, Brice Figureau wrote:> Hum, what''s wrong? > Any idea or work-around?I tried on a complete verbatim environment using debian 0.24.5-2 (both puppetmaster and puppets) with the following simpler site.pp: define deftest () { warning("DEFTEST ${fqdn} on ${name}") file { "${name}": content => "test" } } node "xen1.internal" { $part = "xen1" @@deftest { "/tmp/${part}": tag => "test" } Deftest <<| tag==''test'' |>> } node "xen2.internal" { $part = "xen2" @@deftest { "/tmp/${part}": tag => "test" } Deftest <<| tag==''test'' |>> } Note that as soon as I get rid of deftest define and use directly the File resource, it is working as intended. Then running puppetd on xen1.internal, no /tmp/xen1 is created although the puppetmaster says: info: Caching node for xen1.internal debug: Creating default schedules debug: /Settings[/etc/puppet/puppet.conf]/Settings[puppetmasterd]/File[/etc/puppet/manifests/site.pp]: Autorequiring File[/etc/puppet/manifests] debug: Finishing transaction 23957021037080 with 0 changes debug: Adding code to main on line 82 in file /etc/puppet/manifests/site.pp debug: Scope(Node[xen1.internal]): Collected 1 Deftest resource in 0.01 seconds warning: Scope(Deftest[/tmp/xen1]): DEFTEST xen1.internal on /tmp/xen1 debug: Scope(Node[xen1.internal]): Collected 0 Deftest resources in 0.00 seconds debug: File[/tmp/xen1]: Adding default for backup debug: File[/tmp/xen1]: Adding default for ignore info: Stored catalog for xen1.internal in 1.05 seconds And on xen1.internal after retrieving the plugins, it just says: info: Loading fact netmask info: Loading fact ldap_auth_bind_user info: Loading fact configured_ntp_servers debug: Retrieved facts in 9.27 seconds debug: Retrieving catalog debug: Calling puppetmaster.getconfig debug: Retrieved catalog in 1.65 seconds debug: Creating default schedules info: Caching catalog at /var/lib/puppet/state/localconfig.yaml notice: Starting catalog run debug: Finishing transaction -614176518 with 0 changes debug: Storing state info: Creating state file /var/lib/puppet/state/state.yaml debug: Stored state in 0.06 seconds notice: Finished catalog run in 0.09 seconds And the database contains the collected resource: +-------+-----------+---------+---------+----------------+----------+------+---------------------+ | id | title | restype | host_id | source_file_id | exported | line | updated_at | +-------+-----------+---------+---------+----------------+----------+------+---------------------+ | 51558 | /tmp/xen1 | File | 68 | 1 | 1 | 58 | 2008-07-31 10:19:40 | | 51560 | /tmp/xen1 | Deftest | 68 | 1 | 1 | 69 | 2008-07-31 10:19:40 | +-------+-----------+---------+---------+----------------+----------+------+---------------------+ Now running puppet on xen2 produce the collected /tmp/xen1 file: info: Loading fact configured_ntp_servers info: Loading fact ldap_auth_bind_user info: Loading fact netmask info: Retrieving plugins info: Loading fact configured_ntp_servers info: Loading fact ldap_auth_bind_user info: Loading fact netmask info: Caching catalog at /var/lib/puppet/state/localconfig.yaml notice: Starting catalog run warning: //Node[xen2.internal]/Deftest[/tmp/xen1]/File[/tmp/xen1]/checksum: File /tmp/xen1 does not exist -- cannot checksum notice: //Node[xen2.internal]/Deftest[/tmp/xen1]/File[/tmp/xen1]/checksum: defined ''checksum'' as ''{md5}3d09baddc21a365b7da5ae4d0aa5cb95'' notice: //Node[xen2.internal]/Deftest[/tmp/xen1]/File[/tmp/xen1]/content: created file with contents {md5}3d09baddc21a365b7da5ae4d0aa5cb95 notice: Finished catalog run in 1.17 seconds And on the puppetmaster: info: Expiring the node cache of xen2.internal info: Not using expired node for xen2.internal from cache; expired at Thu Jul 31 10:24:20 +0200 2008 info: Caching node for xen2.internal debug: Scope(Node[xen2.internal]): Collected 2 Deftest resources in 0.01 seconds warning: Scope(Deftest[/tmp/xen2]): DEFTEST xen2.internal on /tmp/xen2 warning: Scope(Deftest[/tmp/xen1]): DEFTEST xen2.internal on /tmp/xen1 debug: Scope(Node[xen2.internal]): Collected 0 Deftest resources in 0.00 seconds debug: File[/tmp/xen2]: Adding default for backup debug: File[/tmp/xen2]: Adding default for ignore debug: File[/tmp/xen1]: Adding default for backup debug: File[/tmp/xen1]: Adding default for ignore debug: File[/var/local]: Adding default for backup debug: File[/var/local]: Adding default for ignore info: Stored catalog for xen2.internal in 0.43 seconds notice: Compiled catalog for xen2.internal in 0.54 seconds Which if I''m not mistaken means that both resources are known by the puppetmaster. in the database: +-------+-----------+---------+---------+----------------+----------+------+---------------------+ | id | title | restype | host_id | source_file_id | exported | line | updated_at | +-------+-----------+---------+---------+----------------+----------+------+---------------------+ | 51563 | /tmp/xen2 | File | 69 | 1 | 1 | 58 | 2008-07-31 10:25:21 | | 51565 | /tmp/xen2 | Deftest | 69 | 1 | 1 | 79 | 2008-07-31 10:25:21 | +-------+-----------+---------+---------+----------------+----------+------+---------------------+ Now back to xen1, running puppet again produce the /tmp/xen2 file but still not the xen1 file. With this simpler manifest I wasn''t able to reproduce the original error I reported (ie the duplicate resource), but I think it is just another view of the same issue. I filed this issue under bug #1472: http://reductivelabs.com/redmine/issues/show/1472 Does anybody uses exported/collected resource successfully ? Does any one who know puppet internals can point me to the code that handle collected resource? I''d like to throw an eye on that and instrument the code to see if I can find the problem. Thanks, -- Brice Figureau <brice-puppet@daysofwonder.com> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Blake Barnett
2008-Jul-31 19:37 UTC
[Puppet Users] Re: Exported/Collect resource not working?
On Jul 31, 2008, at 4:50 AM, Brice Figureau wrote: <snip>> > Does anybody uses exported/collected resource successfully ? > Does any one who know puppet internals can point me to the code that > handle collected resource? I''d like to throw an eye on that and > instrument the code to see if I can find the problem.The code is here: http://github.com/lak/puppet/tree/master/lib/puppet/rails most likely in resource.rb or host.rb, I''m pretty sure these haven''t change in a while (it''s sort of EOL''d waiting for 0.25.5) -Blake --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Brice Figureau
2008-Aug-01 11:58 UTC
[Puppet Users] Re: Exported/Collect resource not working?
On Thu, 2008-07-31 at 12:37 -0700, Blake Barnett wrote:> > On Jul 31, 2008, at 4:50 AM, Brice Figureau wrote: > <snip> > > > > Does anybody uses exported/collected resource successfully ? > > Does any one who know puppet internals can point me to the code that > > handle collected resource? I''d like to throw an eye on that and > > instrument the code to see if I can find the problem. > > The code is here: > http://github.com/lak/puppet/tree/master/lib/puppet/rails > > most likely in resource.rb or host.rb, I''m pretty sure these haven''t > change in a while (it''s sort of EOL''d waiting for 0.25.5)Thanks for the pointers. I finally managed to fully debug (and learn ruby at the same time) the issue, and to propose a patch. More information for those who are interested can be found in the bug report itself: http://reductivelabs.com/redmine/issues/show/1472 Thanks, -- Brice Figureau <brice-puppet@daysofwonder.com> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Brice Figureau
2008-Aug-01 18:13 UTC
[Puppet Users] Re: Exported/Collect resource not working?
On Wed, July 30, 2008 17:39, Brice Figureau wrote:> [snipped the first issue] > OK, back to corp1, and re-running puppet (with the hope the corp2-part > will be collected) I get the following error: > err: Could not retrieve catalog: Puppet::Parser::AST::Resource failed > with error ArgumentError: Duplicate definition: > File[/var/lib/puppet/modules/test/test.d/corp2-part] is already defined; > cannot redefine > at /etc/puppet/modules/common/manifests/defines/concatenated_file.pp:99 > on node corp1.daysofwonder.comThis part of the issue was coming from the fact that I had a module which was collecting File without using any tag (and that''s bad). Then I was collecting twice each exported file (or Concatenated_file_part which embeds a File). -- Brice Figureau --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---