Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-6922 Types that ruby require other types can cause failure Change By: Henrik Lindberg Sprint: PDE Triage Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-6922 Types that ruby require other types can cause failure Change By: Henrik Lindberg Sprint: Forge - To Accept Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Thomas Hallgren assigned an issue to Unassigned Puppet / PUP-6922 Types that ruby require other types can cause failure Change By: Thomas Hallgren Assignee: Thomas Hallgren Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Craig Dunn commented on PUP-6922 Re: Types that ruby require other types can cause failure Henrik Lindberg Thomas Hallgren thanks for the input, i've done some very preliminary testing using Puppet::Type.type(:foo) and it does appear to work for me, at least for my use case. Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Henrik Lindberg commented on PUP-6922 Re: Types that ruby require other types can cause failure Craig Dunn While that works now, it is based on knowledge about the current implementation; that the type's implementation is a Ruby class tied to a particular constant. That will eventually not be true and there is no way to help that code do the right thing in the future. The call Thomas showed is API and will continue to work (or gracefully be changed to something else). Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Craig Dunn commented on PUP-6922 Re: Types that ruby require other types can cause failure Thanks Thomas Hallgren The (potential) problem with this is that under certain circumstances, I think when the puppet master is not pluginsynced or in certain puppet apply scenarios that Puppet can't find the type unless it's specifically references with it's fully qualified path, this was the reason for basing the require on _FILE_ in the first place after this was spotted in https://github.com/crayfishx/puppet-firewalld/issues/78 That issue is quite old and on Puppet 3 and i'll need to verify that we won't re-introduce that issue... I'll test your suggestion in a variety of scenarios and see if it does what we need. In the meantime, a quick work around for the above I came up with was: require File.join(File.dirname(__FILE__),'test_one') unless defined?(Puppet::Type::Test_one) That appears to pass without error. Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Thomas Hallgren commented on PUP-6922 Re: Types that ruby require other types can cause failure A debug trace reveals the following. Broken scenario: 'include tesmodule::broken' is called. the type 'test_one' is autoloaded the type 'test_two' is autoloaded the code in 'test_two' creates the 'test_one' type again. This fails. Working scenario: 'include tesmodule::working' is called. the type 'test_two' is autoloaded the code in 'test_two' creates the 'test_one' type. This succeeds. no autoload of 'test_one' takes place since it's already loaded. I think Puppet does what it is supposed to do. It's not OK to create a type during autoload of another type. Doing so has probably always instantiated two Ruby types in memory but earlier (before the 4x loaders where involved) this went undetected. The correct way to do this is to reference the type instead of forcefully creating it using a require. it. I.e. replace this: require File.join(File.dirname(__FILE__),'test_one') with this: Puppet::Type.type(:test_one)
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Thomas Hallgren assigned an issue to Thomas Hallgren Puppet / PUP-6922 Types that ruby require other types can cause failure Change By: Thomas Hallgren Assignee: Thomas Hallgren Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Craig Dunn commented on PUP-6922 Re: Types that ruby require other types can cause failure It might sound familiar because of PUP-6653 but this seems to be a different issue (but same error) Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Craig Dunn commented on PUP-6922 Re: Types that ruby require other types can cause failure Henrik Lindberg Tested on 4.8.0 and still behaves the same Craigs-MacBook-Pro:testmodule craigdunn$ puppet -V 4.8.0 Craigs-MacBook-Pro:testmodule craigdunn$ puppet apply --modulepath /tmp -e 'include testmodule::broken' Error: Could not autoload puppet/type/test_two: Attempt to redefine entity 'http://puppet.com/2016.1/runtime/type/test_one'. Originally set at file:/tmp/testmodule/lib/puppet/type/test_one.rb?line=1. Error: Evaluation Error: Error while evaluating a Resource Statement, Could not autoload puppet/type/test_two: Attempt to redefine entity 'http://puppet.com/2016.1/runtime/type/test_one'. Originally set at file:/tmp/testmodule/lib/puppet/type/test_one.rb?line=1. at /tmp/testmodule/manifests/broken.pp:7:3 on node craigs-macbook-pro.local Craigs-MacBook-Pro:testmodule craigdunn$ puppet apply --modulepath /tmp -e 'include testmodule::working'
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-6922 Types that ruby require other types can cause failure Change By: Henrik Lindberg Affects Version/s: PUP 4.5.0 Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-6922 Types that ruby require other types can cause failure Change By: Henrik Lindberg Labels: maintenance Team: Puppet Developer Support Sprint: PDS Triage Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Henrik Lindberg commented on PUP-6922 Re: Types that ruby require other types can cause failure That is because the types register themselves, and it fails if the type has already been registered. This may very well be a bug that has been fixed, as this changed again in a later Puppet version. It would be great if it is possible to the latest version. Ping Thomas Hallgren - this sounds familiar... Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Craig Dunn commented on PUP-6922 Re: Types that ruby require other types can cause failure Update, this issue appeared from Puppet 4.5.0 onwards, <= 4.4.2 this worked. Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Craig Dunn updated an issue Puppet / PUP-6922 Types that ruby require other types can cause failure Change By: Craig Dunn ### h2. BackgroundI first saw this issue reported in https://github.com/crayfishx/puppet-firewalld/issues/93 - some resource types need to be able to talk to providers of other resources, such a {{firewalld_direct_purge}} in this module. This requires making sure that the type is loaded when this code runs, historically I've always seen this done something like{code}require File.join(File.dirname(__FILE__),'other_type'){code}With the new resource types system, this seems to break, but only under some circumstances. When the resource type requiring the other type is evaluated first in the manifest, there is never a problem, but when the required resource type is evaluated before the one that requires it, it causes Puppet to throw an error such as:{code}Error: Could not autoload puppet/type/test_two: Attempt to redefine entity 'http://puppet.com/2016.1/runtime/type/test_one'. Originally set at file:/etc/puppetlabs/code/environments/production/modules/testmodule/lib/puppet/type/test_one.rb?line=1.{code} ### h2. SimulatingThis was a bit complex to try and write up in a ticket, so I've created a tiny test module on github that isolates this problem, details in the READMEPlease see:https://github.com/crayfishx/testmodule_demo_codeIf I drop the require statements then the code passes, but that opens up the possibility that the required type has not been loaded when I need to access it's provider, and raises issues for puppet applyetc so I'm not sure how to solve this Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Jira (PUP-6922) Types that ruby require other types can cause failure
Title: Message Title Craig Dunn created an issue Puppet / PUP-6922 Types that ruby require other types can cause failure Issue Type: Bug Assignee: Unassigned Created: 2016/11/16 3:34 AM Priority: Major Reporter: Craig Dunn Background I first saw this issue reported in https://github.com/crayfishx/puppet-firewalld/issues/93 - some resource types need to be able to talk to providers of other resources, such a firewalld_direct_purge in this module. This requires making sure that the type is loaded when this code runs, historically I've always seen this done something like require File.join(File.dirname(__FILE__),'other_type')