Thanks Felix, Usually, in this case, I could create a Module and just mix it in. Unfortunately, I can't find the correct magic to make this work inside of a provider.
The @@ is doing what I want it to, even in 2.0, but there's just no way that I can find to get the warnings to go away. Interestingly, the only "approved" way to use class variables is the one that I'm using it for, to save cross-instance configuration state. It might take hacking the Puppet source directly and, if that's the case, might as well just stuff in a class-based state management system to make all of this easy to do. Thanks, Trevor On Tue, May 27, 2014 at 12:15 PM, Felix Frank < [email protected]> wrote: > On 05/27/2014 06:05 PM, Trevor Vaughan wrote: > > > https://www.onyxpoint.com/storing-puppet-provider-metadata-for-single-instance-application/ > . > > > > However, I've run into a bit of an issue with Ruby 2 in that I can't > > determine the proper method for keeping this technique properly > > functional and getting rid of the following warning "warning: class > > variable access from toplevel". > > > > This is generated each and every time that I access a class variable and > > I'm not quite sure what the correct technique is for fixing the code. > > I'll be honest - the whole scoping in Ruby is pretty mysterious to me at > times. > > If I understood and remember correctly, @@ only does what you need when > used inside instance methods. In class methods or outside of methods, it > would actually refer a member of the class's class (which is Class? or > something...), so it's only @ for the declaration at class scope. > > Again, I may be totally on the wrong track. > > Best, > Felix > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-dev/5384BA0D.5000803%40alumni.tu-berlin.de > . > For more options, visit https://groups.google.com/d/optout. > -- Trevor Vaughan Vice President, Onyx Point, Inc (410) 541-6699 [email protected] -- This account not approved for unencrypted proprietary information -- -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoW9UmAJsJx2drOBSVqu3wrBTFt5iE9N3ag56He8aHCWXA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
