Closed keen99 closed 6 years ago
This is a useful feature. Can this be merged please?
@jtimberman thoughts?
This may cause a no method found exception on nil because chef loads attributes files after it loads resource files.
It's probably safer and more sane to use the homebrew user mixin instead for the default.
good point - I'll see if I can find time to figure out a better route to make this happen. (though "works for me!" haha)
I'll have to look at the homebrew user mixin again - I probably went this route out of simplicity though.
tl;dr - similar to what #21 wants, but less specific - allow the "user" attribute to be set/overridden globally.
trying to use mac_os_x_userdefaults with kitchenplan resulted in...interesting failures. (kitchenplan's own defaults write doesnt support notifies sanely - and I didnt want to rewrite it). turns out kitchenplan runs solo under sudo. so my user level settings were getting set for root, instead of me. kitchenplan does set a correct node['current_user'], though, so I don't need a mixin to get the right user.
To avoid any change to default behaviors, updated the userdefaults :user attribute to consume the new cookbook attribute. This still defaults to nil, so should have zero impact.
For users who want to make the change - simply override node['mac_os_x']['user'] in your role/attributes/cookbook or whatever you prefer. You can even use the cool chef 12 homebrew mixin - http://jtimberman.housepub.org/blog/2014/12/29/chef-12-homebrew-user-mixin/ :)