nicolas
2010-Apr-19 11:56 UTC
[Puppet Users] Migration from 0.24.X to 0.25.x : "Global resource access is deprecated"
Hello, We have a custom type that works well with puppet 0.24.8 but fails with puppet 0.25.4 The failure message is : "Global resource access is deprecated" In the type, we want to create a directory that may already have been defined elsewhere so we''re using code like this : directory = "path_to_some_directory" if Puppet::Type.type(:file)[directory] != nil self.debug("Directory \"#{directory}\" is already managed, nothing to do") else directory_type = Puppet::Type.type(:file).create(:name => directory, :ensure => "directory") end It works with puppet 0.24.8, but not with puppet 0.25.4, so we tried this (inspired by the solution to issue http://projects.puppetlabs.com/issues/2768) : directory = "path_to_some_directory" if resource.catalog.resource(:file, directory) self.debug("Directory \"#{directory}\" is already managed, nothing to do") else directory_type = Puppet::Type.type(:file).create(:name => directory, :ensure => "directory") end It works with puppet 0.25.4, but the test is actually never equal to true. The creation is done twice with the same directory and Puppet does not complain. Is it a Puppet bug or normal behavior ? Should we just drop the test ? Is there any recommend/better way to do this ? Thanks for your help Nicolas -- 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.
nicolas
2010-Apr-22 12:13 UTC
[Puppet Users] Re: Migration from 0.24.X to 0.25.x : "Global resource access is deprecated"
Could anyone help me on this topic, please ? Or point me to up-to-date documentation explaining the good way to do it ? thanks ! nicolas On 19 avr, 13:56, nicolas <ncapp...@yahoo.fr> wrote:> Hello, > > We have a custom type that works well with puppet 0.24.8 but fails > with puppet 0.25.4 > The failure message is : "Global resource access is deprecated" > > In the type, we want to create a directory that may already have > been defined elsewhere so we''re using code like this : > directory = "path_to_some_directory" > if Puppet::Type.type(:file)[directory] != nil > self.debug("Directory \"#{directory}\" is already managed, > nothing to do") > else > directory_type = Puppet::Type.type(:file).create(:name => > directory, :ensure => "directory") > end > > It works with puppet 0.24.8, but not with puppet 0.25.4, so we > tried this (inspired by the solution to issuehttp://projects.puppetlabs.com/issues/2768) > : > > directory = "path_to_some_directory" > if resource.catalog.resource(:file, directory) > self.debug("Directory \"#{directory}\" is already managed, > nothing to do") > else > directory_type = Puppet::Type.type(:file).create(:name => > directory, :ensure => "directory") > end > > It works with puppet 0.25.4, but the test is actually never equal > to true. The creation is done twice with the same directory and Puppet > does not complain. > Is it a Puppet bug or normal behavior ? Should we just drop the > test ? Is there any recommend/better way to do this ? > > Thanks for your help > Nicolas > > -- > 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 athttp://groups.google.com/group/puppet-users?hl=en.-- 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.
Trevor Vaughan
2010-Apr-22 16:21 UTC
Re: [Puppet Users] Re: Migration from 0.24.X to 0.25.x : "Global resource access is deprecated"
Nicolas, I think you should cross-post this to puppet-dev. Trevor On Thu, Apr 22, 2010 at 8:13 AM, nicolas <ncapponi@yahoo.fr> wrote:> Could anyone help me on this topic, please ? > Or point me to up-to-date documentation explaining the good way to do > it ? > > thanks ! > > nicolas > > On 19 avr, 13:56, nicolas <ncapp...@yahoo.fr> wrote: >> Hello, >> >> We have a custom type that works well with puppet 0.24.8 but fails >> with puppet 0.25.4 >> The failure message is : "Global resource access is deprecated" >> >> In the type, we want to create a directory that may already have >> been defined elsewhere so we''re using code like this : >> directory = "path_to_some_directory" >> if Puppet::Type.type(:file)[directory] != nil >> self.debug("Directory \"#{directory}\" is already managed, >> nothing to do") >> else >> directory_type = Puppet::Type.type(:file).create(:name => >> directory, :ensure => "directory") >> end >> >> It works with puppet 0.24.8, but not with puppet 0.25.4, so we >> tried this (inspired by the solution to issuehttp://projects.puppetlabs.com/issues/2768) >> : >> >> directory = "path_to_some_directory" >> if resource.catalog.resource(:file, directory) >> self.debug("Directory \"#{directory}\" is already managed, >> nothing to do") >> else >> directory_type = Puppet::Type.type(:file).create(:name => >> directory, :ensure => "directory") >> end >> >> It works with puppet 0.25.4, but the test is actually never equal >> to true. The creation is done twice with the same directory and Puppet >> does not complain. >> Is it a Puppet bug or normal behavior ? Should we just drop the >> test ? Is there any recommend/better way to do this ? >> >> Thanks for your help >> Nicolas >> >> -- >> 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 athttp://groups.google.com/group/puppet-users?hl=en. > > -- > 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. > >-- Trevor Vaughan Vice President, Onyx Point, Inc (410) 541-6699 tvaughan@onyxpoint.com -- This account not approved for unencrypted proprietary information -- -- 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.