-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fb_helpers contains namespace collisions with official chef node objects #211
Comments
First, I'm not sure why these would cause instability - those methods are in the DSL namespace and not on the node, and should in no way conflict. Second, yes, once FB is fully on Chef 17, it will likely make sense for them to code-mod away from the node methods to the DSL methods, and then deprecate these and remove them, but that's not going to happen over night, so we should figure out why you're having issues with these. |
We agree on the confusion around DSL/Node. We are also seeing some weird behavior with Both are quite confusing though. |
I use If you wanna provide a working example of how |
I need to figure out how to distill it down as the code is deep in our internal libraries. And yeah what's weird is the shell out work just fine on macOS, but not Ubuntu 20. It's very puzzling. For now we are instead calling |
That ... would be the expected behavior. |
sigh I'll close this ticket and create another one once I figure out more info on the shell out. |
We should have looked at this more closely before pointing fingers so apologies about that. |
So actually I want to come back to this (feel free to close if you disagree)
so this is where the confusion happened internally let's say you did something like this in a resource
It would trigger. But what if someone did something like this
There is some level of mental gymnastics here and the solution is not apparent
I'm sure I could distill the issue down further, but hopefully you see the point. With the built-ins in Chef 17, the behavior is different from chef's and facebooks. :: Edit I also figured out the issue I was seeing with shell_out. Ignore that :) |
This also impacts things like
and the logic actually works just fine except
|
I think you see this , but just to be clear, if you call I would say something like "if you want the node ones, make your helper functions in the node otherwise make a helper class you pass the node into" But, if you want to use the equivalent of So what's really happening here is two things:
Getting out of this is a bit tricky because of the way libraries are loaded. One way I can see this working would be:
That would work, but it's a lot of effort and I'm not sure there's bandwidth for it right now on that team. It also has a HUGE risk that if some random cookbook Another option I could see (but I don't like either) is to make a new set of helpers in the node that are dumb wrappers around the DSL ones: def dsl_debian?
ChefUtils::DSL::PlatformFamily.debian?
end and so on. Then everyone can code-mod over to that at their leisure. Then at some point we can drop all the existing helpers. Once we do that everyone can do |
The latter option is something I was thinking about but yeah, none of this is ideal :/ |
Meant to chime in on this one (I thought I already had, sorry!). The wrapper method approach is probably the one we'll end up taking, though not sure about the codemod aspects of removing |
Well, the non-node varieties are mixed into the Recipe DSL, so they're easy to reason about. No different than |
In chef v17, chef added a lot of built-ins and we are seeing instability with at least one of them
https://github.com/facebook/chef-cookbooks/blob/main/cookbooks/fb_helpers/libraries/node_methods.rb#L146
when we call
debian?
within a library function, it returns false, so we are now having to dodebian? || ubuntu?
to workaround this as we consume fb_helpers.To put this nicely, is Facebook willing to stop doing this? Or at the very least, stop putting so many of these things in
node
and put it to a FB namespace?The text was updated successfully, but these errors were encountered: