-
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
modernize shell_out method syntax #4865
Conversation
**options has worked ever since we've deprecated ruby 1.9.x
@chef/client-core trivial cleanup of ruby 1.8.7-era arguments mangling... |
👍 |
This seems like a lot of oddly duplicated code still. |
def shell_out(*args, **options)
# For backwards compat, in case something below us modifies args?
args = args.dup
options = options.dup
env_key = options.has_key?(:env) ? :env : :environment
options[env_key] = {
"LC_ALL" => Chef::Config[:internal_locale],
"LANGUAGE" => Chef::Config[:internal_locale],
"LANG" => Chef::Config[:internal_locale],
}.update(options[env_key] || {})
shell_out_command(*args, **options)
end That should be equivalent, right? |
you still have to dup options[env_key] i think |
oh wait... parsing... |
I think that should be correct, it's a new hash object .update'd with the old one, should mutate the new object. |
yeah, that works the same in my head, lets see if it works the same in the tests.. |
We should have a comment on the |
i think it is unintentional now and can be deleted? |
we only ever did this in order to mutate the options and with the **options syntax we don't need to do this anymore.
Or that, is there anything below this in the call stack that expects to modify the args but doesn't |
oh there's the deprecated options garbage... |
Yeah, might need to fix a few more functions at the same time :-( |
yeah i got my yak trimmer out... |
actually i think this works, #run_command_compatible_options does a #dup on args itself, and mixlib-shellout doesn't mangle its own args... |
👍 the deprecation code is gross but this should work I think (travis failure looks unrelated) |
yeah but the deprecation code all gets nuked from orbit, hopefully soonish, whenever we start with Chef-13. i just want to make sure that when we grep for |
Current coverage is 100%@@ master #4865 diff @@
=====================================
Files 0 0
Lines 0 0
Methods 0 0
Messages 0 0
Branches 0 0
=====================================
Hits 0 0
Misses 0 0
Partials 0 0
|
uh, lolwut? |
**options has worked ever since we've deprecated ruby 1.9.x