{"action":"opened","number":2054,"pull_request":{"url":"https://api.github.com/repos/mitchellh/packer/pulls/2054","id":33585513,"html_url":"https://github.com/mitchellh/packer/pull/2054","diff_url":"https://github.com/mitchellh/packer/pull/2054.diff","patch_url":"https://github.com/mitchellh/packer/pull/2054.patch","issue_url":"https://api.github.com/repos/mitchellh/packer/issues/2054","number":2054,"state":"open","locked":false,"title":"Only unmount if path is actually mounted","user":{"login":"garnaat","id":2056,"avatar_url":"https://avatars.githubusercontent.com/u/2056?v=3","gravatar_id":"","url":"https://api.github.com/users/garnaat","html_url":"https://github.com/garnaat","followers_url":"https://api.github.com/users/garnaat/followers","following_url":"https://api.github.com/users/garnaat/following{/other_user}","gists_url":"https://api.github.com/users/garnaat/gists{/gist_id}","starred_url":"https://api.github.com/users/garnaat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garnaat/subscriptions","organizations_url":"https://api.github.com/users/garnaat/orgs","repos_url":"https://api.github.com/users/garnaat/repos","events_url":"https://api.github.com/users/garnaat/events{/privacy}","received_events_url":"https://api.github.com/users/garnaat/received_events","type":"User","site_admin":false},"body":"In the Amazon chroot builder, a number of paths are unmounted via umount commands.  However, if any of these paths are already unmounted the builder fails.  This PR is an attempt to make the builder a bit more tolerant of paths that have already been unmounted.\r\n\r\nThere is no perfect way to check to see if a path is currently mounted or not but the general consensus seems to be that grepping for the path in ``/proc/mounts`` is as good a way as any.  So, this PR attempts to do the grep command prior to attempting the call to ``umount``.\r\n\r\nIf grep returns a ``0`` it means the path was found in ``/proc/mounts`` and the ``umount`` command proceeds as before.  \r\n\r\nIf the grep returns a ``1`` it means that the grep command completely successfully but then path was not found in ``/proc/mounts``.  In this case, the path is already unmounted and so no ``umount`` command is attempted.\r\n\r\nIf the grep returns anything else or any other error occurs during the grep operation, the ``umount`` is attempted as before.\r\n\r\nI have done some adhoc testing of this but I'm not familiar enough with the project to know if there is a logical place to add more tests specific to this new functionality.","created_at":"2015-04-17T21:50:01Z","updated_at":"2015-04-17T21:50:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mitchellh/packer/pulls/2054/commits","review_comments_url":"https://api.github.com/repos/mitchellh/packer/pulls/2054/comments","review_comment_url":"https://api.github.com/repos/mitchellh/packer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mitchellh/packer/issues/2054/comments","statuses_url":"https://api.github.com/repos/mitchellh/packer/statuses/fd5f4c61ae419f3abe324876a532f011370f1e69","head":{"label":"garnaat:amazon-chroot-check-before-umount","ref":"amazon-chroot-check-before-umount","sha":"fd5f4c61ae419f3abe324876a532f011370f1e69","user":{"login":"garnaat","id":2056,"avatar_url":"https://avatars.githubusercontent.com/u/2056?v=3","gravatar_id":"","url":"https://api.github.com/users/garnaat","html_url":"https://github.com/garnaat","followers_url":"https://api.github.com/users/garnaat/followers","following_url":"https://api.github.com/users/garnaat/following{/other_user}","gists_url":"https://api.github.com/users/garnaat/gists{/gist_id}","starred_url":"https://api.github.com/users/garnaat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garnaat/subscriptions","organizations_url":"https://api.github.com/users/garnaat/orgs","repos_url":"https://api.github.com/users/garnaat/repos","events_url":"https://api.github.com/users/garnaat/events{/privacy}","received_events_url":"https://api.github.com/users/garnaat/received_events","type":"User","site_admin":false},"repo":{"id":34113138,"name":"packer","full_name":"garnaat/packer","owner":{"login":"garnaat","id":2056,"avatar_url":"https://avatars.githubusercontent.com/u/2056?v=3","gravatar_id":"","url":"https://api.github.com/users/garnaat","html_url":"https://github.com/garnaat","followers_url":"https://api.github.com/users/garnaat/followers","following_url":"https://api.github.com/users/garnaat/following{/other_user}","gists_url":"https://api.github.com/users/garnaat/gists{/gist_id}","starred_url":"https://api.github.com/users/garnaat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garnaat/subscriptions","organizations_url":"https://api.github.com/users/garnaat/orgs","repos_url":"https://api.github.com/users/garnaat/repos","events_url":"https://api.github.com/users/garnaat/events{/privacy}","received_events_url":"https://api.github.com/users/garnaat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/garnaat/packer","description":"Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.","fork":true,"url":"https://api.github.com/repos/garnaat/packer","forks_url":"https://api.github.com/repos/garnaat/packer/forks","keys_url":"https://api.github.com/repos/garnaat/packer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/garnaat/packer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/garnaat/packer/teams","hooks_url":"https://api.github.com/repos/garnaat/packer/hooks","issue_events_url":"https://api.github.com/repos/garnaat/packer/issues/events{/number}","events_url":"https://api.github.com/repos/garnaat/packer/events","assignees_url":"https://api.github.com/repos/garnaat/packer/assignees{/user}","branches_url":"https://api.github.com/repos/garnaat/packer/branches{/branch}","tags_url":"https://api.github.com/repos/garnaat/packer/tags","blobs_url":"https://api.github.com/repos/garnaat/packer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/garnaat/packer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/garnaat/packer/git/refs{/sha}","trees_url":"https://api.github.com/repos/garnaat/packer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/garnaat/packer/statuses/{sha}","languages_url":"https://api.github.com/repos/garnaat/packer/languages","stargazers_url":"https://api.github.com/repos/garnaat/packer/stargazers","contributors_url":"https://api.github.com/repos/garnaat/packer/contributors","subscribers_url":"https://api.github.com/repos/garnaat/packer/subscribers","subscription_url":"https://api.github.com/repos/garnaat/packer/subscription","commits_url":"https://api.github.com/repos/garnaat/packer/commits{/sha}","git_commits_url":"https://api.github.com/repos/garnaat/packer/git/commits{/sha}","comments_url":"https://api.github.com/repos/garnaat/packer/comments{/number}","issue_comment_url":"https://api.github.com/repos/garnaat/packer/issues/comments{/number}","contents_url":"https://api.github.com/repos/garnaat/packer/contents/{+path}","compare_url":"https://api.github.com/repos/garnaat/packer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/garnaat/packer/merges","archive_url":"https://api.github.com/repos/garnaat/packer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/garnaat/packer/downloads","issues_url":"https://api.github.com/repos/garnaat/packer/issues{/number}","pulls_url":"https://api.github.com/repos/garnaat/packer/pulls{/number}","milestones_url":"https://api.github.com/repos/garnaat/packer/milestones{/number}","notifications_url":"https://api.github.com/repos/garnaat/packer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/garnaat/packer/labels{/name}","releases_url":"https://api.github.com/repos/garnaat/packer/releases{/id}","created_at":"2015-04-17T11:34:11Z","updated_at":"2015-04-17T11:34:13Z","pushed_at":"2015-04-17T19:35:44Z","git_url":"git://github.com/garnaat/packer.git","ssh_url":"git@github.com:garnaat/packer.git","clone_url":"https://github.com/garnaat/packer.git","svn_url":"https://github.com/garnaat/packer","homepage":"http://www.packer.io","size":20949,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mitchellh:master","ref":"master","sha":"419f3271f1f5382be620a070a937c6ed435f185d","user":{"login":"mitchellh","id":1299,"avatar_url":"https://avatars.githubusercontent.com/u/1299?v=3","gravatar_id":"","url":"https://api.github.com/users/mitchellh","html_url":"https://github.com/mitchellh","followers_url":"https://api.github.com/users/mitchellh/followers","following_url":"https://api.github.com/users/mitchellh/following{/other_user}","gists_url":"https://api.github.com/users/mitchellh/gists{/gist_id}","starred_url":"https://api.github.com/users/mitchellh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitchellh/subscriptions","organizations_url":"https://api.github.com/users/mitchellh/orgs","repos_url":"https://api.github.com/users/mitchellh/repos","events_url":"https://api.github.com/users/mitchellh/events{/privacy}","received_events_url":"https://api.github.com/users/mitchellh/received_events","type":"User","site_admin":false},"repo":{"id":8966356,"name":"packer","full_name":"mitchellh/packer","owner":{"login":"mitchellh","id":1299,"avatar_url":"https://avatars.githubusercontent.com/u/1299?v=3","gravatar_id":"","url":"https://api.github.com/users/mitchellh","html_url":"https://github.com/mitchellh","followers_url":"https://api.github.com/users/mitchellh/followers","following_url":"https://api.github.com/users/mitchellh/following{/other_user}","gists_url":"https://api.github.com/users/mitchellh/gists{/gist_id}","starred_url":"https://api.github.com/users/mitchellh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitchellh/subscriptions","organizations_url":"https://api.github.com/users/mitchellh/orgs","repos_url":"https://api.github.com/users/mitchellh/repos","events_url":"https://api.github.com/users/mitchellh/events{/privacy}","received_events_url":"https://api.github.com/users/mitchellh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mitchellh/packer","description":"Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.","fork":false,"url":"https://api.github.com/repos/mitchellh/packer","forks_url":"https://api.github.com/repos/mitchellh/packer/forks","keys_url":"https://api.github.com/repos/mitchellh/packer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitchellh/packer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitchellh/packer/teams","hooks_url":"https://api.github.com/repos/mitchellh/packer/hooks","issue_events_url":"https://api.github.com/repos/mitchellh/packer/issues/events{/number}","events_url":"https://api.github.com/repos/mitchellh/packer/events","assignees_url":"https://api.github.com/repos/mitchellh/packer/assignees{/user}","branches_url":"https://api.github.com/repos/mitchellh/packer/branches{/branch}","tags_url":"https://api.github.com/repos/mitchellh/packer/tags","blobs_url":"https://api.github.com/repos/mitchellh/packer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitchellh/packer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitchellh/packer/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitchellh/packer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitchellh/packer/statuses/{sha}","languages_url":"https://api.github.com/repos/mitchellh/packer/languages","stargazers_url":"https://api.github.com/repos/mitchellh/packer/stargazers","contributors_url":"https://api.github.com/repos/mitchellh/packer/contributors","subscribers_url":"https://api.github.com/repos/mitchellh/packer/subscribers","subscription_url":"https://api.github.com/repos/mitchellh/packer/subscription","commits_url":"https://api.github.com/repos/mitchellh/packer/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitchellh/packer/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitchellh/packer/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitchellh/packer/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitchellh/packer/contents/{+path}","compare_url":"https://api.github.com/repos/mitchellh/packer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitchellh/packer/merges","archive_url":"https://api.github.com/repos/mitchellh/packer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitchellh/packer/downloads","issues_url":"https://api.github.com/repos/mitchellh/packer/issues{/number}","pulls_url":"https://api.github.com/repos/mitchellh/packer/pulls{/number}","milestones_url":"https://api.github.com/repos/mitchellh/packer/milestones{/number}","notifications_url":"https://api.github.com/repos/mitchellh/packer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitchellh/packer/labels{/name}","releases_url":"https://api.github.com/repos/mitchellh/packer/releases{/id}","created_at":"2013-03-23T05:43:03Z","updated_at":"2015-04-17T19:20:37Z","pushed_at":"2015-04-17T21:50:01Z","git_url":"git://github.com/mitchellh/packer.git","ssh_url":"git@github.com:mitchellh/packer.git","clone_url":"https://github.com/mitchellh/packer.git","svn_url":"https://github.com/mitchellh/packer","homepage":"http://www.packer.io","size":20949,"stargazers_count":3857,"watchers_count":3857,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":765,"mirror_url":null,"open_issues_count":320,"forks":765,"open_issues":320,"watchers":3857,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mitchellh/packer/pulls/2054"},"html":{"href":"https://github.com/mitchellh/packer/pull/2054"},"issue":{"href":"https://api.github.com/repos/mitchellh/packer/issues/2054"},"comments":{"href":"https://api.github.com/repos/mitchellh/packer/issues/2054/comments"},"review_comments":{"href":"https://api.github.com/repos/mitchellh/packer/pulls/2054/comments"},"review_comment":{"href":"https://api.github.com/repos/mitchellh/packer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mitchellh/packer/pulls/2054/commits"},"statuses":{"href":"https://api.github.com/repos/mitchellh/packer/statuses/fd5f4c61ae419f3abe324876a532f011370f1e69"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":28,"deletions":2,"changed_files":1}}