{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/vagrant/issues/4334","labels_url":"https://api.github.com/repos/mitchellh/vagrant/issues/4334/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/vagrant/issues/4334/comments","events_url":"https://api.github.com/repos/mitchellh/vagrant/issues/4334/events","html_url":"https://github.com/mitchellh/vagrant/issues/4334","id":40009504,"number":4334,"title":"Provision command to refresh environment variables","user":{"login":"vmrob","id":622110,"avatar_url":"https://avatars.githubusercontent.com/u/622110?v=3","gravatar_id":"","url":"https://api.github.com/users/vmrob","html_url":"https://github.com/vmrob","followers_url":"https://api.github.com/users/vmrob/followers","following_url":"https://api.github.com/users/vmrob/following{/other_user}","gists_url":"https://api.github.com/users/vmrob/gists{/gist_id}","starred_url":"https://api.github.com/users/vmrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmrob/subscriptions","organizations_url":"https://api.github.com/users/vmrob/orgs","repos_url":"https://api.github.com/users/vmrob/repos","events_url":"https://api.github.com/users/vmrob/events{/privacy}","received_events_url":"https://api.github.com/users/vmrob/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mitchellh/vagrant/labels/enhancement","name":"enhancement","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2014-08-11T22:58:09Z","updated_at":"2016-01-12T17:04:32Z","closed_at":null,"body":"I'm falling short on what might be appropriate syntax as Vagrant is still relatively new to me, but let me explain the relevant feature and use case as best as I can:\r\n\r\nThere are cases where a basebox may not have all of the system environment variables pre-configured. One such case is where Chef is both installed _and_ used in the same Vagrantfile. When this is the case, the user has to go out of the way to provide a means to sync up environment variables with the ssh process or WinRM process (is this possible?). The only workaround on Windows I'm aware of is to explicitly specify the chef binary location using `chef.binary_path = 'c:/opscode/chef/bin'`. This obviously doesn't work as a general solution.\r\n\r\nMy proposal is to include provisioner utility that simply disconnects ssh/winrm and then reconnects to the guest VM. I think this would provide a simple workaround that may have more use cases than I'm stating here."},"comment":{"url":"https://api.github.com/repos/mitchellh/vagrant/issues/comments/170976549","html_url":"https://github.com/mitchellh/vagrant/issues/4334#issuecomment-170976549","issue_url":"https://api.github.com/repos/mitchellh/vagrant/issues/4334","id":170976549,"user":{"login":"ryanewtaylor","id":1215819,"avatar_url":"https://avatars.githubusercontent.com/u/1215819?v=3","gravatar_id":"","url":"https://api.github.com/users/ryanewtaylor","html_url":"https://github.com/ryanewtaylor","followers_url":"https://api.github.com/users/ryanewtaylor/followers","following_url":"https://api.github.com/users/ryanewtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ryanewtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanewtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanewtaylor/subscriptions","organizations_url":"https://api.github.com/users/ryanewtaylor/orgs","repos_url":"https://api.github.com/users/ryanewtaylor/repos","events_url":"https://api.github.com/users/ryanewtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ryanewtaylor/received_events","type":"User","site_admin":false},"created_at":"2016-01-12T17:04:32Z","updated_at":"2016-01-12T17:04:32Z","body":"@StefanScherer I added https://github.com/chocolatey/chocolatey-test-environment/blob/master/shell/NotifyGuiAppsOfEnvironmentChanges.ps1 as well and that resolved an issue on the guest virtual machine not updating the PATH but it did not seem to address the issue of the WinRM session not getting the updated environment paths.\r\n\r\nI use separate provision scripts as well but for some reason this does not seem to skirt around the issue. For instance I have:\r\n\r\n```\r\nconfig.vm.provision \"shell\", path: \"./scripts/InstallChocolatey.ps1\"\r\nconfig.vm.provision \"shell\", path: \"./scripts/NotifyGuiAppsOfEnvironmentChanges.ps1\"\r\nconfig.vm.provision \"shell\", path: \"./scripts/InstallApps.ps1\"\r\n```\r\n\r\n`./scripts/InstallApps.ps1 simply installs ConEmu. It looks like this:\r\n\r\n```\r\n$env:Path += \";C:\\ProgramData\\chocolatey\\bin\"\r\nchocolatey feature enable -n=allowGlobalConfirmation\r\nchoco install conemu\r\nchocolatey feature disable -n=allowGlobalConfirmation\r\n```\r\nHowever, without the first line hard coding the path, the shell script fails as it cannot find a path to `choco`. It's very strange as most repos I find using Vagrant do not seem to have this issue. The only solid reference to this is this ticket.\r\n\r\nFWIW I have documented the issue and my current attempts on StackOverflow."}}