-
Notifications
You must be signed in to change notification settings - Fork 170
chef exec rspec not working #103
Comments
Can you run the following commands to give us more info?
These are all working for me locally but on a slightly different version. |
|
I think I've got this figured out, should have a patch shortly. We're currently passing our desired environment directly to ruby's exec, like this: https://github.com/opscode/chef-dk/blob/384153920fe5dc16dce71076eb8fa13a2ab33442/lib/chef-dk/command/exec.rb#L27 From my tests, this seems to modify the environment of the child program but doesn't affect the PATH used to find and invoke the command. SET_ENV = {"PATH" => "/opt/chefdk/embedded/bin"}
exec_1 = fork do
exec(SET_ENV, %q{ruby -v})
end
Process.wait(exec_1)
exec_2 = fork do
SET_ENV.each {|k,v| ENV[k] = v}
exec(%q{ruby -v})
end
Process.wait(exec_2) In the first case, I get the version of my system ruby, in the second case I get the omnibus ruby from ChefDK. So it should be easy enough to fix. |
@danielsdeleo - thanks for the follow up and I too have run into some weird exec issues in the past. Glad you were able to reproduce. Let me know when the patch is ready and I'll give it a try. |
@jperry fixed in master, but updating the chef-dk app without installing a full ChefDK package is a bit involved. If you want to try it right away, you can nuke /opt/chefdk/embedded/apps/chef-dk, and then git clone master into that directory which should work (but be prepared to trash everything and reinstall if you do this). Otherwise there should be a nightly build in a day or so that you can run. |
Thanks. I'll check out one of the nightly builds. |
…fixes port client-test fixes into install-test
Hey guys,
I am using chefdk 0.2.0 and and trying to run rspec without resetting my shell using
chef exec rspec
but things are not working. I was told I had to update the chefspec gem usingchef gem install chefspec
due to a dependency on rspec3 but that did not fix the issue. Here is the latest out:The workaround at the moment is to run
eval "$(chef shell-init SHELL_NAME)"
and then you can run rspec directly.The text was updated successfully, but these errors were encountered: