{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/vagrant/issues/7524","repository_url":"https://api.github.com/repos/mitchellh/vagrant","labels_url":"https://api.github.com/repos/mitchellh/vagrant/issues/7524/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/vagrant/issues/7524/comments","events_url":"https://api.github.com/repos/mitchellh/vagrant/issues/7524/events","html_url":"https://github.com/mitchellh/vagrant/pull/7524","id":162500559,"number":7524,"title":"A more reliable way to detect Ubuntu","user":{"login":"nishidayuya","id":62389,"avatar_url":"https://avatars.githubusercontent.com/u/62389?v=3","gravatar_id":"","url":"https://api.github.com/users/nishidayuya","html_url":"https://github.com/nishidayuya","followers_url":"https://api.github.com/users/nishidayuya/followers","following_url":"https://api.github.com/users/nishidayuya/following{/other_user}","gists_url":"https://api.github.com/users/nishidayuya/gists{/gist_id}","starred_url":"https://api.github.com/users/nishidayuya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nishidayuya/subscriptions","organizations_url":"https://api.github.com/users/nishidayuya/orgs","repos_url":"https://api.github.com/users/nishidayuya/repos","events_url":"https://api.github.com/users/nishidayuya/events{/privacy}","received_events_url":"https://api.github.com/users/nishidayuya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"sethvargo","id":408570,"avatar_url":"https://avatars.githubusercontent.com/u/408570?v=3","gravatar_id":"","url":"https://api.github.com/users/sethvargo","html_url":"https://github.com/sethvargo","followers_url":"https://api.github.com/users/sethvargo/followers","following_url":"https://api.github.com/users/sethvargo/following{/other_user}","gists_url":"https://api.github.com/users/sethvargo/gists{/gist_id}","starred_url":"https://api.github.com/users/sethvargo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethvargo/subscriptions","organizations_url":"https://api.github.com/users/sethvargo/orgs","repos_url":"https://api.github.com/users/sethvargo/repos","events_url":"https://api.github.com/users/sethvargo/events{/privacy}","received_events_url":"https://api.github.com/users/sethvargo/received_events","type":"User","site_admin":false},"assignees":[{"login":"sethvargo","id":408570,"avatar_url":"https://avatars.githubusercontent.com/u/408570?v=3","gravatar_id":"","url":"https://api.github.com/users/sethvargo","html_url":"https://github.com/sethvargo","followers_url":"https://api.github.com/users/sethvargo/followers","following_url":"https://api.github.com/users/sethvargo/following{/other_user}","gists_url":"https://api.github.com/users/sethvargo/gists{/gist_id}","starred_url":"https://api.github.com/users/sethvargo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethvargo/subscriptions","organizations_url":"https://api.github.com/users/sethvargo/orgs","repos_url":"https://api.github.com/users/sethvargo/repos","events_url":"https://api.github.com/users/sethvargo/events{/privacy}","received_events_url":"https://api.github.com/users/sethvargo/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-06-27T17:04:26Z","updated_at":"2016-06-29T16:55:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mitchellh/vagrant/pulls/7524","html_url":"https://github.com/mitchellh/vagrant/pull/7524","diff_url":"https://github.com/mitchellh/vagrant/pull/7524.diff","patch_url":"https://github.com/mitchellh/vagrant/pull/7524.patch"},"body":"`lsb_release` command is included in lsb-release package. Sometimes this is not installed; ex: Docker official Ubuntu image.\r\n\r\n```sh\r\n$ docker run --rm -it ubuntu:precise bash -l -c 'lsb_release -i'\r\nbash: lsb_release: command not found\r\n$ docker run --rm -it ubuntu:trusty bash -l -c 'lsb_release -i' \r\nDistributor ID: Ubuntu\r\n$ docker run --rm -it ubuntu:xenial bash -l -c 'lsb_release -i'\r\nbash: lsb_release: command not found\r\n```\r\n\r\n`/etc/os-release` is included in base-files package, so this is more reliable than lsb_release.\r\n\r\n```sh\r\n$ docker run --rm -it ubuntu:precise bash -l -c '. /etc/os-release && echo $ID'  \r\nubuntu\r\n$ docker run --rm -it ubuntu:trusty bash -l -c '. /etc/os-release && echo $ID' \r\nubuntu\r\n$ docker run --rm -it ubuntu:xenial bash -l -c '. /etc/os-release && echo $ID'\r\nubuntu\r\n```\r\n\r\nThis pull-request uses `/etc/os-release` for Ubuntu detection.\r\n"},"comment":{"url":"https://api.github.com/repos/mitchellh/vagrant/issues/comments/229419114","html_url":"https://github.com/mitchellh/vagrant/pull/7524#issuecomment-229419114","issue_url":"https://api.github.com/repos/mitchellh/vagrant/issues/7524","id":229419114,"user":{"login":"nishidayuya","id":62389,"avatar_url":"https://avatars.githubusercontent.com/u/62389?v=3","gravatar_id":"","url":"https://api.github.com/users/nishidayuya","html_url":"https://github.com/nishidayuya","followers_url":"https://api.github.com/users/nishidayuya/followers","following_url":"https://api.github.com/users/nishidayuya/following{/other_user}","gists_url":"https://api.github.com/users/nishidayuya/gists{/gist_id}","starred_url":"https://api.github.com/users/nishidayuya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nishidayuya/subscriptions","organizations_url":"https://api.github.com/users/nishidayuya/orgs","repos_url":"https://api.github.com/users/nishidayuya/repos","events_url":"https://api.github.com/users/nishidayuya/events{/privacy}","received_events_url":"https://api.github.com/users/nishidayuya/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T16:55:07Z","updated_at":"2016-06-29T16:55:07Z","body":"We can try following:\r\n\r\n# Setup\r\n\r\nRequires `Vagrant` repository and `Docker`.\r\n\r\nCreates following `Vagrantfile`.\r\n\r\n```ruby\r\n# -*- mode: ruby -*-\r\n# vi: set ft=ruby :\r\n\r\nVagrant.configure(2) do |config|\r\n  config.vm.provider(:docker) do |d|\r\n    d.image = \"test_ubuntu\"\r\n    d.has_ssh = true\r\n  end\r\nend\r\n```\r\n\r\nDownload `Dockerfile` via `wget` or `curl`.\r\n\r\n* Ubuntu Xenial: https://raw.githubusercontent.com/nishidayuya/docker-vagrant-ubuntu/d5d296694da65af1440b007f7761392736286cdb/Dockerfile\r\n* Ubuntu Trusty: https://raw.githubusercontent.com/nishidayuya/docker-vagrant-ubuntu/106882046ca45b189c167e1599c2236422c8844b/Dockerfile\r\n    * This version is no problem.\r\n    * Because official `ubuntu:trusty` image contains `lsb-release` package (so it is fat image :sob: ).\r\n* Ubuntu Precise: https://raw.githubusercontent.com/nishidayuya/docker-vagrant-ubuntu/8b444efb2815205de153d5cd2682c1d5d12cca1f/Dockerfile\r\n\r\nCreates Docker image for Vagrant.\r\n\r\n```sh\r\n$ docker build -t test_ubuntu .\r\n```\r\n\r\n# Before pull-request\r\n\r\nVagrant cannot detect Ubuntu (except Ubuntu Trusty).\r\n\r\n```sh\r\n$ bundle exec vagrant destroy -f\r\n$ bundle exec vagrant up --provider=docker --debug 2> /tmp/before.log\r\n$ sed -n -e '/^DEBUG guest: Trying: ubuntu/, /^DEBUG ssh: Exit status: / p' \\\r\n    /tmp/before.log\r\nDEBUG guest: Trying: ubuntu\r\nDEBUG ssh: Re-using SSH connection.\r\n INFO ssh: Execute: [ -x /usr/bin/lsb_release ] && /usr/bin/lsb_release -i 2>/dev/null | grep Ubuntu (sudo=false)\r\nDEBUG ssh: Exit status: 1\r\n```\r\n\r\n# After pull-request\r\n\r\nVagrant can detect Ubuntu.\r\n\r\n```sh\r\n$ bundle exec vagrant destroy -f\r\n$ bundle exec vagrant up --provider=docker --debug 2> /tmp/after.log\r\n$ sed -n -e '/^DEBUG guest: Trying: ubuntu/, /^DEBUG ssh: Exit status: / p' \\\r\n    /tmp/after.log\r\nDEBUG guest: Trying: ubuntu\r\nDEBUG ssh: Re-using SSH connection.\r\n INFO ssh: Execute: test -r /etc/os-release && . /etc/os-release && test xubuntu = x$ID (sudo=false)\r\nDEBUG ssh: Exit status: 0\r\n```\r\n"}}
{"actor":{"display_login":"nishidayuya"}}