{"action":"closed","number":1330,"pull_request":{"url":"https://api.github.com/repos/foosel/OctoPrint/pulls/1330","id":69359068,"html_url":"https://github.com/foosel/OctoPrint/pull/1330","diff_url":"https://github.com/foosel/OctoPrint/pull/1330.diff","patch_url":"https://github.com/foosel/OctoPrint/pull/1330.patch","issue_url":"https://api.github.com/repos/foosel/OctoPrint/issues/1330","number":1330,"state":"closed","locked":false,"title":"Make Server class octoprint_daemon-aware, make sure terminated() gets…","user":{"login":"kevans91","id":646318,"avatar_url":"https://avatars.githubusercontent.com/u/646318?v=3","gravatar_id":"","url":"https://api.github.com/users/kevans91","html_url":"https://github.com/kevans91","followers_url":"https://api.github.com/users/kevans91/followers","following_url":"https://api.github.com/users/kevans91/following{/other_user}","gists_url":"https://api.github.com/users/kevans91/gists{/gist_id}","starred_url":"https://api.github.com/users/kevans91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevans91/subscriptions","organizations_url":"https://api.github.com/users/kevans91/orgs","repos_url":"https://api.github.com/users/kevans91/repos","events_url":"https://api.github.com/users/kevans91/events{/privacy}","received_events_url":"https://api.github.com/users/kevans91/received_events","type":"User","site_admin":false},"body":"#### What does this PR do and why is it necessary?\r\n\r\nThis PR is for cleaning up the pidfile of a daemonized instance upon termination. This is my proposed solution to address issue #1324 \r\n\r\n#### How was it tested? How can it be tested by the reviewer?\r\n\r\n```\r\noctoprint --daemon start --pid /tmp/octoprint.pid\r\nkill -TERM `cat /tmp/octoprint.pid`\r\nls -l /tmp/octoprint.pid\r\n```\r\n\r\n#### What are the relevant tickets if any?\r\n#1324 \r\n\r\n#### Screenshots (if appropriate)\r\n\r\n#### Further notes\r\nThis seems like the necessary solution for this case. The Server class handles clean-up and termination, so it seems to make the most sense to make it octoprint_daemon-aware and force a clean-up of the Daemon instance. The exit() is no longer needed, as the termination should otherwise be handled as it normally is (now). \r\n\r\nThis was previously created as #1328, but this iteration addresses the concern by @foosel that we should be cleaning up the pidfile later on in termination. This iteration moves the octoprint daemon cleanup to on_shutdown() instead, just before printing 'Goodbye!', and mentions in the log that it's cleaning up the pidfile. This does mean that we're no longer cleaning up the pidfile strictly on SIGTERM, but that's probably okay because if _octoprint_daemon is not None then we really need to clean up after it if we can.","created_at":"2016-05-09T14:59:02Z","updated_at":"2016-05-12T08:17:47Z","closed_at":"2016-05-12T08:17:47Z","merged_at":"2016-05-12T08:17:47Z","merge_commit_sha":"75f8facb058cb5a260535ba8c8c138da3b46117f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/foosel/OctoPrint/pulls/1330/commits","review_comments_url":"https://api.github.com/repos/foosel/OctoPrint/pulls/1330/comments","review_comment_url":"https://api.github.com/repos/foosel/OctoPrint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/foosel/OctoPrint/issues/1330/comments","statuses_url":"https://api.github.com/repos/foosel/OctoPrint/statuses/75f8facb058cb5a260535ba8c8c138da3b46117f","head":{"label":"kevans91:devel-pid_cleanup2","ref":"devel-pid_cleanup2","sha":"75f8facb058cb5a260535ba8c8c138da3b46117f","user":{"login":"kevans91","id":646318,"avatar_url":"https://avatars.githubusercontent.com/u/646318?v=3","gravatar_id":"","url":"https://api.github.com/users/kevans91","html_url":"https://github.com/kevans91","followers_url":"https://api.github.com/users/kevans91/followers","following_url":"https://api.github.com/users/kevans91/following{/other_user}","gists_url":"https://api.github.com/users/kevans91/gists{/gist_id}","starred_url":"https://api.github.com/users/kevans91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevans91/subscriptions","organizations_url":"https://api.github.com/users/kevans91/orgs","repos_url":"https://api.github.com/users/kevans91/repos","events_url":"https://api.github.com/users/kevans91/events{/privacy}","received_events_url":"https://api.github.com/users/kevans91/received_events","type":"User","site_admin":false},"repo":{"id":58059382,"name":"OctoPrint","full_name":"kevans91/OctoPrint","owner":{"login":"kevans91","id":646318,"avatar_url":"https://avatars.githubusercontent.com/u/646318?v=3","gravatar_id":"","url":"https://api.github.com/users/kevans91","html_url":"https://github.com/kevans91","followers_url":"https://api.github.com/users/kevans91/followers","following_url":"https://api.github.com/users/kevans91/following{/other_user}","gists_url":"https://api.github.com/users/kevans91/gists{/gist_id}","starred_url":"https://api.github.com/users/kevans91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevans91/subscriptions","organizations_url":"https://api.github.com/users/kevans91/orgs","repos_url":"https://api.github.com/users/kevans91/repos","events_url":"https://api.github.com/users/kevans91/events{/privacy}","received_events_url":"https://api.github.com/users/kevans91/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kevans91/OctoPrint","description":"OctoPrint is the snappy web interface for your 3D printer!","fork":true,"url":"https://api.github.com/repos/kevans91/OctoPrint","forks_url":"https://api.github.com/repos/kevans91/OctoPrint/forks","keys_url":"https://api.github.com/repos/kevans91/OctoPrint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kevans91/OctoPrint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kevans91/OctoPrint/teams","hooks_url":"https://api.github.com/repos/kevans91/OctoPrint/hooks","issue_events_url":"https://api.github.com/repos/kevans91/OctoPrint/issues/events{/number}","events_url":"https://api.github.com/repos/kevans91/OctoPrint/events","assignees_url":"https://api.github.com/repos/kevans91/OctoPrint/assignees{/user}","branches_url":"https://api.github.com/repos/kevans91/OctoPrint/branches{/branch}","tags_url":"https://api.github.com/repos/kevans91/OctoPrint/tags","blobs_url":"https://api.github.com/repos/kevans91/OctoPrint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kevans91/OctoPrint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kevans91/OctoPrint/git/refs{/sha}","trees_url":"https://api.github.com/repos/kevans91/OctoPrint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kevans91/OctoPrint/statuses/{sha}","languages_url":"https://api.github.com/repos/kevans91/OctoPrint/languages","stargazers_url":"https://api.github.com/repos/kevans91/OctoPrint/stargazers","contributors_url":"https://api.github.com/repos/kevans91/OctoPrint/contributors","subscribers_url":"https://api.github.com/repos/kevans91/OctoPrint/subscribers","subscription_url":"https://api.github.com/repos/kevans91/OctoPrint/subscription","commits_url":"https://api.github.com/repos/kevans91/OctoPrint/commits{/sha}","git_commits_url":"https://api.github.com/repos/kevans91/OctoPrint/git/commits{/sha}","comments_url":"https://api.github.com/repos/kevans91/OctoPrint/comments{/number}","issue_comment_url":"https://api.github.com/repos/kevans91/OctoPrint/issues/comments{/number}","contents_url":"https://api.github.com/repos/kevans91/OctoPrint/contents/{+path}","compare_url":"https://api.github.com/repos/kevans91/OctoPrint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kevans91/OctoPrint/merges","archive_url":"https://api.github.com/repos/kevans91/OctoPrint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kevans91/OctoPrint/downloads","issues_url":"https://api.github.com/repos/kevans91/OctoPrint/issues{/number}","pulls_url":"https://api.github.com/repos/kevans91/OctoPrint/pulls{/number}","milestones_url":"https://api.github.com/repos/kevans91/OctoPrint/milestones{/number}","notifications_url":"https://api.github.com/repos/kevans91/OctoPrint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kevans91/OctoPrint/labels{/name}","releases_url":"https://api.github.com/repos/kevans91/OctoPrint/releases{/id}","deployments_url":"https://api.github.com/repos/kevans91/OctoPrint/deployments","created_at":"2016-05-04T14:38:26Z","updated_at":"2016-05-04T14:38:28Z","pushed_at":"2016-05-09T14:41:50Z","git_url":"git://github.com/kevans91/OctoPrint.git","ssh_url":"git@github.com:kevans91/OctoPrint.git","clone_url":"https://github.com/kevans91/OctoPrint.git","svn_url":"https://github.com/kevans91/OctoPrint","homepage":"http://octoprint.org","size":44169,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"foosel:devel","ref":"devel","sha":"9e2a1f81a1347630665e088bfbd0cf256132b711","user":{"login":"foosel","id":83657,"avatar_url":"https://avatars.githubusercontent.com/u/83657?v=3","gravatar_id":"","url":"https://api.github.com/users/foosel","html_url":"https://github.com/foosel","followers_url":"https://api.github.com/users/foosel/followers","following_url":"https://api.github.com/users/foosel/following{/other_user}","gists_url":"https://api.github.com/users/foosel/gists{/gist_id}","starred_url":"https://api.github.com/users/foosel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foosel/subscriptions","organizations_url":"https://api.github.com/users/foosel/orgs","repos_url":"https://api.github.com/users/foosel/repos","events_url":"https://api.github.com/users/foosel/events{/privacy}","received_events_url":"https://api.github.com/users/foosel/received_events","type":"User","site_admin":false},"repo":{"id":7386799,"name":"OctoPrint","full_name":"foosel/OctoPrint","owner":{"login":"foosel","id":83657,"avatar_url":"https://avatars.githubusercontent.com/u/83657?v=3","gravatar_id":"","url":"https://api.github.com/users/foosel","html_url":"https://github.com/foosel","followers_url":"https://api.github.com/users/foosel/followers","following_url":"https://api.github.com/users/foosel/following{/other_user}","gists_url":"https://api.github.com/users/foosel/gists{/gist_id}","starred_url":"https://api.github.com/users/foosel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foosel/subscriptions","organizations_url":"https://api.github.com/users/foosel/orgs","repos_url":"https://api.github.com/users/foosel/repos","events_url":"https://api.github.com/users/foosel/events{/privacy}","received_events_url":"https://api.github.com/users/foosel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/foosel/OctoPrint","description":"OctoPrint is the snappy web interface for your 3D printer!","fork":false,"url":"https://api.github.com/repos/foosel/OctoPrint","forks_url":"https://api.github.com/repos/foosel/OctoPrint/forks","keys_url":"https://api.github.com/repos/foosel/OctoPrint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/foosel/OctoPrint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/foosel/OctoPrint/teams","hooks_url":"https://api.github.com/repos/foosel/OctoPrint/hooks","issue_events_url":"https://api.github.com/repos/foosel/OctoPrint/issues/events{/number}","events_url":"https://api.github.com/repos/foosel/OctoPrint/events","assignees_url":"https://api.github.com/repos/foosel/OctoPrint/assignees{/user}","branches_url":"https://api.github.com/repos/foosel/OctoPrint/branches{/branch}","tags_url":"https://api.github.com/repos/foosel/OctoPrint/tags","blobs_url":"https://api.github.com/repos/foosel/OctoPrint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/foosel/OctoPrint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/foosel/OctoPrint/git/refs{/sha}","trees_url":"https://api.github.com/repos/foosel/OctoPrint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/foosel/OctoPrint/statuses/{sha}","languages_url":"https://api.github.com/repos/foosel/OctoPrint/languages","stargazers_url":"https://api.github.com/repos/foosel/OctoPrint/stargazers","contributors_url":"https://api.github.com/repos/foosel/OctoPrint/contributors","subscribers_url":"https://api.github.com/repos/foosel/OctoPrint/subscribers","subscription_url":"https://api.github.com/repos/foosel/OctoPrint/subscription","commits_url":"https://api.github.com/repos/foosel/OctoPrint/commits{/sha}","git_commits_url":"https://api.github.com/repos/foosel/OctoPrint/git/commits{/sha}","comments_url":"https://api.github.com/repos/foosel/OctoPrint/comments{/number}","issue_comment_url":"https://api.github.com/repos/foosel/OctoPrint/issues/comments{/number}","contents_url":"https://api.github.com/repos/foosel/OctoPrint/contents/{+path}","compare_url":"https://api.github.com/repos/foosel/OctoPrint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/foosel/OctoPrint/merges","archive_url":"https://api.github.com/repos/foosel/OctoPrint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/foosel/OctoPrint/downloads","issues_url":"https://api.github.com/repos/foosel/OctoPrint/issues{/number}","pulls_url":"https://api.github.com/repos/foosel/OctoPrint/pulls{/number}","milestones_url":"https://api.github.com/repos/foosel/OctoPrint/milestones{/number}","notifications_url":"https://api.github.com/repos/foosel/OctoPrint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/foosel/OctoPrint/labels{/name}","releases_url":"https://api.github.com/repos/foosel/OctoPrint/releases{/id}","deployments_url":"https://api.github.com/repos/foosel/OctoPrint/deployments","created_at":"2012-12-31T12:20:57Z","updated_at":"2016-05-11T20:09:09Z","pushed_at":"2016-05-12T08:17:45Z","git_url":"git://github.com/foosel/OctoPrint.git","ssh_url":"git@github.com:foosel/OctoPrint.git","clone_url":"https://github.com/foosel/OctoPrint.git","svn_url":"https://github.com/foosel/OctoPrint","homepage":"http://octoprint.org","size":61906,"stargazers_count":1322,"watchers_count":1322,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":575,"mirror_url":null,"open_issues_count":189,"forks":575,"open_issues":189,"watchers":1322,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/foosel/OctoPrint/pulls/1330"},"html":{"href":"https://github.com/foosel/OctoPrint/pull/1330"},"issue":{"href":"https://api.github.com/repos/foosel/OctoPrint/issues/1330"},"comments":{"href":"https://api.github.com/repos/foosel/OctoPrint/issues/1330/comments"},"review_comments":{"href":"https://api.github.com/repos/foosel/OctoPrint/pulls/1330/comments"},"review_comment":{"href":"https://api.github.com/repos/foosel/OctoPrint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/foosel/OctoPrint/pulls/1330/commits"},"statuses":{"href":"https://api.github.com/repos/foosel/OctoPrint/statuses/75f8facb058cb5a260535ba8c8c138da3b46117f"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"foosel","id":83657,"avatar_url":"https://avatars.githubusercontent.com/u/83657?v=3","gravatar_id":"","url":"https://api.github.com/users/foosel","html_url":"https://github.com/foosel","followers_url":"https://api.github.com/users/foosel/followers","following_url":"https://api.github.com/users/foosel/following{/other_user}","gists_url":"https://api.github.com/users/foosel/gists{/gist_id}","starred_url":"https://api.github.com/users/foosel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foosel/subscriptions","organizations_url":"https://api.github.com/users/foosel/orgs","repos_url":"https://api.github.com/users/foosel/repos","events_url":"https://api.github.com/users/foosel/events{/privacy}","received_events_url":"https://api.github.com/users/foosel/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"commits":1,"additions":13,"deletions":21,"changed_files":4}}