{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/vagrant/issues/10507","repository_url":"https://api.github.com/repos/hashicorp/vagrant","labels_url":"https://api.github.com/repos/hashicorp/vagrant/issues/10507/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/vagrant/issues/10507/comments","events_url":"https://api.github.com/repos/hashicorp/vagrant/issues/10507/events","html_url":"https://github.com/hashicorp/vagrant/issues/10507","id":391416911,"node_id":"MDU6SXNzdWUzOTE0MTY5MTE=","number":10507,"title":"Non-zero exit code is not honored by shell provisioner","user":{"login":"gokhansengun","id":5166755,"node_id":"MDQ6VXNlcjUxNjY3NTU=","avatar_url":"https://avatars3.githubusercontent.com/u/5166755?v=4","gravatar_id":"","url":"https://api.github.com/users/gokhansengun","html_url":"https://github.com/gokhansengun","followers_url":"https://api.github.com/users/gokhansengun/followers","following_url":"https://api.github.com/users/gokhansengun/following{/other_user}","gists_url":"https://api.github.com/users/gokhansengun/gists{/gist_id}","starred_url":"https://api.github.com/users/gokhansengun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gokhansengun/subscriptions","organizations_url":"https://api.github.com/users/gokhansengun/orgs","repos_url":"https://api.github.com/users/gokhansengun/repos","events_url":"https://api.github.com/users/gokhansengun/events{/privacy}","received_events_url":"https://api.github.com/users/gokhansengun/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-15T22:26:28Z","updated_at":"2018-12-15T22:43:20Z","closed_at":"2018-12-15T22:43:20Z","author_association":"CONTRIBUTOR","body":"### Vagrant version\r\nVagrant 2.2.0\r\n\r\n### Host operating system\r\nmacOS\r\n\r\n### Guest operating system\r\nLinux (hashicorp/precise64)\r\n\r\n### Vagrantfile\r\n```ruby\r\nVagrant.configure(\"2\") do |config|\r\n  config.vm.box = \"hashicorp/precise64\"\r\n\r\n  config.vm.provision \"test\", type:\"shell\", inline: \"$SHELL /vagrant/fail.sh\"\r\nend\r\n```\r\nContent of `fail.sh` script: \r\n\r\nNote the `-e` flag to cause script stop execution with non-zero exit code of any commands.\r\n\r\n```bash\r\n#!/bin/bash -e\r\n\r\necho \"Before the error\"\r\n\r\n/bin/false\r\n\r\necho \"After the error\"\r\n```\r\n\r\n### Debug output\r\nhttps://gist.github.com/gokhansengun/27b7363418761bb432d27cabb0ef63ba\r\n\r\n### Expected behavior\r\nProvisioner should honor `bash`'s `-e` flag, bubble the error and cause provisioning to fail in case of a non-zero error code in the script. Below output should be seen.\r\n\r\n```bash\r\n==> default: Running provisioner: test (shell)...\r\n    default: Running: inline script\r\n    default: Before the error\r\n```\r\n\r\n### Actual behavior\r\nShell provisioner continues to execute even when there is a non-zero error code in the script. Below output is seen.\r\n\r\n```bash\r\n==> default: Running provisioner: test (shell)...\r\n    default: Running: inline script\r\n    default: Before the error\r\n    default: After the error\r\n```\r\n\r\n### Steps to reproduce\r\n1. Have Vagrantfile and `fail.sh` script on the same directory (using VirtualBox)\r\n2. Issue `vagrant up` command\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/vagrant/issues/comments/447603159","html_url":"https://github.com/hashicorp/vagrant/issues/10507#issuecomment-447603159","issue_url":"https://api.github.com/repos/hashicorp/vagrant/issues/10507","id":447603159,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NzYwMzE1OQ==","user":{"login":"gokhansengun","id":5166755,"node_id":"MDQ6VXNlcjUxNjY3NTU=","avatar_url":"https://avatars3.githubusercontent.com/u/5166755?v=4","gravatar_id":"","url":"https://api.github.com/users/gokhansengun","html_url":"https://github.com/gokhansengun","followers_url":"https://api.github.com/users/gokhansengun/followers","following_url":"https://api.github.com/users/gokhansengun/following{/other_user}","gists_url":"https://api.github.com/users/gokhansengun/gists{/gist_id}","starred_url":"https://api.github.com/users/gokhansengun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gokhansengun/subscriptions","organizations_url":"https://api.github.com/users/gokhansengun/orgs","repos_url":"https://api.github.com/users/gokhansengun/repos","events_url":"https://api.github.com/users/gokhansengun/events{/privacy}","received_events_url":"https://api.github.com/users/gokhansengun/received_events","type":"User","site_admin":false},"created_at":"2018-12-15T22:43:20Z","updated_at":"2018-12-15T22:43:20Z","author_association":"CONTRIBUTOR","body":"Sorry, no Vagrant issue. It is due to the missing `-c` option to the shell.\r\n\r\n```\r\nconfig.vm.provision \"test\", type:\"shell\", inline: \"$SHELL -c /vagrant/fail.sh\"\r\n```\r\n"}}
{"actor":{"display_login":"gokhansengun"}}