{"action":"created","comment":{"url":"https://api.github.com/repos/puppetlabs/puppet/pulls/comments/50883999","id":50883999,"diff_hunk":"@@ -171,6 +178,30 @@\n       @apply.run_command\n     end\n \n+    it \"should use a filesystem lock to restrict multiple processes running\" do\n+      @apply.expects(:lock)\n+      @apply.run_command\n+    end\n+\n+    describe \"when a filesystem lock is encountered\" do\n+      before :each do\n+        @apply.expects(:lock).raises(Puppet::LockError, 'locked')\n+        Puppet.expects(:notice).with(regexp_matches /Run of Puppet already in progress; skipping  (.+ exists)/)\n+      end\n+\n+      it \"should exit\" do\n+        expect { @apply.run_command }.to raise_error(SystemExit)","path":"spec/unit/application/apply_spec.rb","position":37,"original_position":37,"commit_id":"109ddeb6cc5d39df96101b77f2d396d157fcd91a","original_commit_id":"109ddeb6cc5d39df96101b77f2d396d157fcd91a","user":{"login":"MikaelSmith","id":8162496,"avatar_url":"https://avatars.githubusercontent.com/u/8162496?v=3","gravatar_id":"","url":"https://api.github.com/users/MikaelSmith","html_url":"https://github.com/MikaelSmith","followers_url":"https://api.github.com/users/MikaelSmith/followers","following_url":"https://api.github.com/users/MikaelSmith/following{/other_user}","gists_url":"https://api.github.com/users/MikaelSmith/gists{/gist_id}","starred_url":"https://api.github.com/users/MikaelSmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikaelSmith/subscriptions","organizations_url":"https://api.github.com/users/MikaelSmith/orgs","repos_url":"https://api.github.com/users/MikaelSmith/repos","events_url":"https://api.github.com/users/MikaelSmith/events{/privacy}","received_events_url":"https://api.github.com/users/MikaelSmith/received_events","type":"User","site_admin":false},"body":"Found out from @joshcooper that there's a helper for this, https://github.com/puppetlabs/puppet/blob/master/spec/integration/application/apply_spec.rb#L38, so we can drop lines 192-201 down to one spec test.","created_at":"2016-01-26T19:14:42Z","updated_at":"2016-01-26T19:14:42Z","html_url":"https://github.com/puppetlabs/puppet/pull/4584#discussion_r50883999","pull_request_url":"https://api.github.com/repos/puppetlabs/puppet/pulls/4584","_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/comments/50883999"},"html":{"href":"https://github.com/puppetlabs/puppet/pull/4584#discussion_r50883999"},"pull_request":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/4584"}}},"pull_request":{"url":"https://api.github.com/repos/puppetlabs/puppet/pulls/4584","id":56580743,"html_url":"https://github.com/puppetlabs/puppet/pull/4584","diff_url":"https://github.com/puppetlabs/puppet/pull/4584.diff","patch_url":"https://github.com/puppetlabs/puppet/pull/4584.patch","issue_url":"https://api.github.com/repos/puppetlabs/puppet/issues/4584","number":4584,"state":"open","locked":false,"title":"(PUP-5609) Protect shared state with filesystem lock","user":{"login":"dalen","id":7400,"avatar_url":"https://avatars.githubusercontent.com/u/7400?v=3","gravatar_id":"","url":"https://api.github.com/users/dalen","html_url":"https://github.com/dalen","followers_url":"https://api.github.com/users/dalen/followers","following_url":"https://api.github.com/users/dalen/following{/other_user}","gists_url":"https://api.github.com/users/dalen/gists{/gist_id}","starred_url":"https://api.github.com/users/dalen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dalen/subscriptions","organizations_url":"https://api.github.com/users/dalen/orgs","repos_url":"https://api.github.com/users/dalen/repos","events_url":"https://api.github.com/users/dalen/events{/privacy}","received_events_url":"https://api.github.com/users/dalen/received_events","type":"User","site_admin":true},"body":"Use a filesytem lock when running Puppet apply. This prevents multiple\r\nsimultaneous writes to the same state files by multiple apply processes\r\nor a mix of apply and agent processes (the same state files are shared\r\nby apply and agent).\r\n\r\nThis time it exits with status 1 if lock is already taken and has some tests for that from @MikaelSmith (from https://github.com/puppetlabs/puppet/pull/4582).","created_at":"2016-01-20T09:10:01Z","updated_at":"2016-01-26T19:14:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7affecd8129b80378df4be8c5c0b9048ea1e8a2f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/puppetlabs/puppet/pulls/4584/commits","review_comments_url":"https://api.github.com/repos/puppetlabs/puppet/pulls/4584/comments","review_comment_url":"https://api.github.com/repos/puppetlabs/puppet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/puppetlabs/puppet/issues/4584/comments","statuses_url":"https://api.github.com/repos/puppetlabs/puppet/statuses/109ddeb6cc5d39df96101b77f2d396d157fcd91a","head":{"label":"dalen:apply_lock","ref":"apply_lock","sha":"109ddeb6cc5d39df96101b77f2d396d157fcd91a","user":{"login":"dalen","id":7400,"avatar_url":"https://avatars.githubusercontent.com/u/7400?v=3","gravatar_id":"","url":"https://api.github.com/users/dalen","html_url":"https://github.com/dalen","followers_url":"https://api.github.com/users/dalen/followers","following_url":"https://api.github.com/users/dalen/following{/other_user}","gists_url":"https://api.github.com/users/dalen/gists{/gist_id}","starred_url":"https://api.github.com/users/dalen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dalen/subscriptions","organizations_url":"https://api.github.com/users/dalen/orgs","repos_url":"https://api.github.com/users/dalen/repos","events_url":"https://api.github.com/users/dalen/events{/privacy}","received_events_url":"https://api.github.com/users/dalen/received_events","type":"User","site_admin":true},"repo":{"id":4496917,"name":"puppet","full_name":"dalen/puppet","owner":{"login":"dalen","id":7400,"avatar_url":"https://avatars.githubusercontent.com/u/7400?v=3","gravatar_id":"","url":"https://api.github.com/users/dalen","html_url":"https://github.com/dalen","followers_url":"https://api.github.com/users/dalen/followers","following_url":"https://api.github.com/users/dalen/following{/other_user}","gists_url":"https://api.github.com/users/dalen/gists{/gist_id}","starred_url":"https://api.github.com/users/dalen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dalen/subscriptions","organizations_url":"https://api.github.com/users/dalen/orgs","repos_url":"https://api.github.com/users/dalen/repos","events_url":"https://api.github.com/users/dalen/events{/privacy}","received_events_url":"https://api.github.com/users/dalen/received_events","type":"User","site_admin":true},"private":false,"html_url":"https://github.com/dalen/puppet","description":"Server automation framework and application","fork":true,"url":"https://api.github.com/repos/dalen/puppet","forks_url":"https://api.github.com/repos/dalen/puppet/forks","keys_url":"https://api.github.com/repos/dalen/puppet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dalen/puppet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dalen/puppet/teams","hooks_url":"https://api.github.com/repos/dalen/puppet/hooks","issue_events_url":"https://api.github.com/repos/dalen/puppet/issues/events{/number}","events_url":"https://api.github.com/repos/dalen/puppet/events","assignees_url":"https://api.github.com/repos/dalen/puppet/assignees{/user}","branches_url":"https://api.github.com/repos/dalen/puppet/branches{/branch}","tags_url":"https://api.github.com/repos/dalen/puppet/tags","blobs_url":"https://api.github.com/repos/dalen/puppet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dalen/puppet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dalen/puppet/git/refs{/sha}","trees_url":"https://api.github.com/repos/dalen/puppet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dalen/puppet/statuses/{sha}","languages_url":"https://api.github.com/repos/dalen/puppet/languages","stargazers_url":"https://api.github.com/repos/dalen/puppet/stargazers","contributors_url":"https://api.github.com/repos/dalen/puppet/contributors","subscribers_url":"https://api.github.com/repos/dalen/puppet/subscribers","subscription_url":"https://api.github.com/repos/dalen/puppet/subscription","commits_url":"https://api.github.com/repos/dalen/puppet/commits{/sha}","git_commits_url":"https://api.github.com/repos/dalen/puppet/git/commits{/sha}","comments_url":"https://api.github.com/repos/dalen/puppet/comments{/number}","issue_comment_url":"https://api.github.com/repos/dalen/puppet/issues/comments{/number}","contents_url":"https://api.github.com/repos/dalen/puppet/contents/{+path}","compare_url":"https://api.github.com/repos/dalen/puppet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dalen/puppet/merges","archive_url":"https://api.github.com/repos/dalen/puppet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dalen/puppet/downloads","issues_url":"https://api.github.com/repos/dalen/puppet/issues{/number}","pulls_url":"https://api.github.com/repos/dalen/puppet/pulls{/number}","milestones_url":"https://api.github.com/repos/dalen/puppet/milestones{/number}","notifications_url":"https://api.github.com/repos/dalen/puppet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dalen/puppet/labels{/name}","releases_url":"https://api.github.com/repos/dalen/puppet/releases{/id}","deployments_url":"https://api.github.com/repos/dalen/puppet/deployments","created_at":"2012-05-30T16:07:26Z","updated_at":"2015-10-23T09:24:38Z","pushed_at":"2016-01-20T09:08:49Z","git_url":"git://github.com/dalen/puppet.git","ssh_url":"git@github.com:dalen/puppet.git","clone_url":"https://github.com/dalen/puppet.git","svn_url":"https://github.com/dalen/puppet","homepage":"http://www.puppetlabs.com/puppet/introduction/","size":51846,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"puppetlabs:master","ref":"master","sha":"e84e32a91983cd44da4be6064bfd90ce6a85e352","user":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":910744,"name":"puppet","full_name":"puppetlabs/puppet","owner":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/puppetlabs/puppet","description":"Server automation framework and application","fork":false,"url":"https://api.github.com/repos/puppetlabs/puppet","forks_url":"https://api.github.com/repos/puppetlabs/puppet/forks","keys_url":"https://api.github.com/repos/puppetlabs/puppet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/puppetlabs/puppet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/puppetlabs/puppet/teams","hooks_url":"https://api.github.com/repos/puppetlabs/puppet/hooks","issue_events_url":"https://api.github.com/repos/puppetlabs/puppet/issues/events{/number}","events_url":"https://api.github.com/repos/puppetlabs/puppet/events","assignees_url":"https://api.github.com/repos/puppetlabs/puppet/assignees{/user}","branches_url":"https://api.github.com/repos/puppetlabs/puppet/branches{/branch}","tags_url":"https://api.github.com/repos/puppetlabs/puppet/tags","blobs_url":"https://api.github.com/repos/puppetlabs/puppet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/puppetlabs/puppet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/puppetlabs/puppet/git/refs{/sha}","trees_url":"https://api.github.com/repos/puppetlabs/puppet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/puppetlabs/puppet/statuses/{sha}","languages_url":"https://api.github.com/repos/puppetlabs/puppet/languages","stargazers_url":"https://api.github.com/repos/puppetlabs/puppet/stargazers","contributors_url":"https://api.github.com/repos/puppetlabs/puppet/contributors","subscribers_url":"https://api.github.com/repos/puppetlabs/puppet/subscribers","subscription_url":"https://api.github.com/repos/puppetlabs/puppet/subscription","commits_url":"https://api.github.com/repos/puppetlabs/puppet/commits{/sha}","git_commits_url":"https://api.github.com/repos/puppetlabs/puppet/git/commits{/sha}","comments_url":"https://api.github.com/repos/puppetlabs/puppet/comments{/number}","issue_comment_url":"https://api.github.com/repos/puppetlabs/puppet/issues/comments{/number}","contents_url":"https://api.github.com/repos/puppetlabs/puppet/contents/{+path}","compare_url":"https://api.github.com/repos/puppetlabs/puppet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/puppetlabs/puppet/merges","archive_url":"https://api.github.com/repos/puppetlabs/puppet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/puppetlabs/puppet/downloads","issues_url":"https://api.github.com/repos/puppetlabs/puppet/issues{/number}","pulls_url":"https://api.github.com/repos/puppetlabs/puppet/pulls{/number}","milestones_url":"https://api.github.com/repos/puppetlabs/puppet/milestones{/number}","notifications_url":"https://api.github.com/repos/puppetlabs/puppet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/puppetlabs/puppet/labels{/name}","releases_url":"https://api.github.com/repos/puppetlabs/puppet/releases{/id}","deployments_url":"https://api.github.com/repos/puppetlabs/puppet/deployments","created_at":"2010-09-14T19:26:44Z","updated_at":"2016-01-26T07:40:34Z","pushed_at":"2016-01-26T19:05:48Z","git_url":"git://github.com/puppetlabs/puppet.git","ssh_url":"git@github.com:puppetlabs/puppet.git","clone_url":"https://github.com/puppetlabs/puppet.git","svn_url":"https://github.com/puppetlabs/puppet","homepage":"https://puppetlabs.com/puppet/what-is-puppet","size":78239,"stargazers_count":3771,"watchers_count":3771,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1558,"mirror_url":null,"open_issues_count":36,"forks":1558,"open_issues":36,"watchers":3771,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/4584"},"html":{"href":"https://github.com/puppetlabs/puppet/pull/4584"},"issue":{"href":"https://api.github.com/repos/puppetlabs/puppet/issues/4584"},"comments":{"href":"https://api.github.com/repos/puppetlabs/puppet/issues/4584/comments"},"review_comments":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/4584/comments"},"review_comment":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/4584/commits"},"statuses":{"href":"https://api.github.com/repos/puppetlabs/puppet/statuses/109ddeb6cc5d39df96101b77f2d396d157fcd91a"}}}}