-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Added source_file to FromFile #6938
Conversation
chefstyle issues that are making travis unhappy would need to get fixed. this is one instance where i think i'd argue that kind of looks like class_from_file should be updated as well, although i have no idea how that gets used and maybe it isn't appropriate, IDK... bit worried that this mixin may get used well outside of core chef as well, although now would be a good time to get it in for 14.0 then. |
I think this is mergable once the chefstyle problems are fixed @zfjagann - thanks for your contribution to Chef! |
I addressed the comments above, including chef style issues, using
This is also something I thought about, but can't easily address, since I don't have access to code outside of the chef codebase (or our own site's chef code). I did, however, set the The only case where this would change behavior unexpectedly is if someone loaded a file which included |
This new field tracks the file from which the object was loaded. Signed-off-by: Zeal Jagannatha <[email protected]>
I looked at the failing appveyor output and I wasn't able to determine what the problem was from the output (most of the output didn't look related to my PR). If it's a problem with this PR please let me know and I will fix it. |
We think the intermittent appveyor problems are caused by the instance running out of memory; not your fault! |
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread. |
Description
This adds a new field
source_file
to theFromFile
mixin that contains the source file used to load the object.This is useful if you want to trace back a Role/Cookbook::Metadata to the file it was generated from.
We have some scripts that do some custom validation on Role/Cookbook::Metadata objects and currently monkeypatch the FromFile class to contain this attribute, but it'd be nice to have upstream and get rid of the monkeypatch. They mostly use this information to provide meaningful error messages to users in the event that this custom validation fails.
I double-checked that none of the classes using FromFile were already using the name
source_file
for something else, so this won't conflict with any of the code in the chef repo. Happy to rename if desired.I didn't update
RELEASE_NOTES.d
since I thought this was a small change, but I can do that too, if necessary.Issues Resolved
None
Check List