Morning all I'm trying to add some validation to a new type I've written[1] for my Puppet-glassfish module[2].
As part of the validation, I need to access the current catalog to make sure that there's no another resources defined with the same *:name* and *:target *values. The reason behind this is that the Glassfish provider command will fail if there is, and I'd like to prevent that by validating at the type level... The validate block I've added is here[3], which I've modelled closely on an autorequire block[4]. However whenever I try and run the spec tests, it fails with: 'undefined method `catalog` for nil:NilClass'. [5] I've tried changing line 85 to different values, such as 'catalog.resources', 'self.catalog.resources', '@catalog.resources', '@resource.catalog.resources', and all return the same error... So is it possible to access the catalog from within a validate block? Or is there a better way to achieve what I'm trying to do? Cheers in advance for any replies. Regards Gavin [1] https://github.com/fatmcgav/fatmcgav-glassfish/blob/feature/add_resource_ref/lib/puppet/type/resourceref.rb [2] https://github.com/fatmcgav/fatmcgav-glassfish [3] https://github.com/fatmcgav/fatmcgav-glassfish/blob/feature/add_resource_ref/lib/puppet/type/resourceref.rb#L83-L92 [4] https://github.com/fatmcgav/fatmcgav-glassfish/blob/feature/add_resource_ref/lib/puppet/type/resourceref.rb#L117-L126 [5] https://travis-ci.org/fatmcgav/fatmcgav-glassfish/jobs/53320865#L1447-L1453 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/66050a1f-b969-4852-b271-8b7526b307cf%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.