{"action":"created","comment":{"url":"https://api.github.com/repos/project-koku/koku/pulls/comments/184717597","pull_request_review_id":115975150,"id":184717597,"diff_hunk":"@@ -0,0 +1,104 @@\n+#\n+# Copyright 2018 Red Hat, Inc.\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU Affero General Public License as\n+# published by the Free Software Foundation, either version 3 of the\n+# License, or (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU Affero General Public License for more details.\n+#\n+# You should have received a copy of the GNU Affero General Public License\n+# along with this program.  If not, see <https://www.gnu.org/licenses/>.\n+#\n+\n+\"\"\"Models to capture server status.\"\"\"\n+\n+import logging\n+import os\n+import platform\n+import subprocess\n+import sys\n+import uuid\n+\n+from django.db import models\n+\n+from api import API_VERSION\n+\n+logger = logging.getLogger(__name__)  # pylint: disable=invalid-name\n+\n+\n+class Status(models.Model):\n+    \"\"\"A server's status.\"\"\"\n+\n+    server_id = models.UUIDField(default=uuid.uuid4,\n+                                 editable=False)\n+\n+    def get_commit(self):  # pylint: disable=R0201\n+        \"\"\"Collect the build number for the server.\n+\n+        :returns: A build number\n+        \"\"\"\n+        commit_info = os.environ.get('KOKU_COMMIT', None)\n+        if commit_info is None:\n+            try:\n+                commit_info = subprocess.check_output(['git',\n+                                                       'describe',\n+                                                       '--always'])\n+                commit_info = commit_info.decode('utf-8').strip()\n+            except subprocess.CalledProcessError:","path":"koku/api/status/model.py","position":52,"original_position":52,"commit_id":"f51473de258da21d34db5fe3625f2c2ce1786e31","original_commit_id":"179457f55e7d2b7b5bff12268d5b092c0b249fae","user":{"login":"adberglund","id":3845021,"avatar_url":"https://avatars1.githubusercontent.com/u/3845021?v=4","gravatar_id":"","url":"https://api.github.com/users/adberglund","html_url":"https://github.com/adberglund","followers_url":"https://api.github.com/users/adberglund/followers","following_url":"https://api.github.com/users/adberglund/following{/other_user}","gists_url":"https://api.github.com/users/adberglund/gists{/gist_id}","starred_url":"https://api.github.com/users/adberglund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adberglund/subscriptions","organizations_url":"https://api.github.com/users/adberglund/orgs","repos_url":"https://api.github.com/users/adberglund/repos","events_url":"https://api.github.com/users/adberglund/events{/privacy}","received_events_url":"https://api.github.com/users/adberglund/received_events","type":"User","site_admin":false},"body":"I still feel funny about this being in a try/except where the except is just a pass. `subprocess.run()` should usable with the check flag set to False so that an exception is not raised.","created_at":"2018-04-27T15:11:10Z","updated_at":"2018-04-27T15:11:19Z","html_url":"https://github.com/project-koku/koku/pull/67#discussion_r184717597","pull_request_url":"https://api.github.com/repos/project-koku/koku/pulls/67","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/project-koku/koku/pulls/comments/184717597"},"html":{"href":"https://github.com/project-koku/koku/pull/67#discussion_r184717597"},"pull_request":{"href":"https://api.github.com/repos/project-koku/koku/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/project-koku/koku/pulls/67","id":184642645,"html_url":"https://github.com/project-koku/koku/pull/67","diff_url":"https://github.com/project-koku/koku/pull/67.diff","patch_url":"https://github.com/project-koku/koku/pull/67.patch","issue_url":"https://api.github.com/repos/project-koku/koku/issues/67","number":67,"state":"open","locked":false,"title":"Create basic status endpoint. Closes #36.","user":{"login":"chambridge","id":29379759,"avatar_url":"https://avatars3.githubusercontent.com/u/29379759?v=4","gravatar_id":"","url":"https://api.github.com/users/chambridge","html_url":"https://github.com/chambridge","followers_url":"https://api.github.com/users/chambridge/followers","following_url":"https://api.github.com/users/chambridge/following{/other_user}","gists_url":"https://api.github.com/users/chambridge/gists{/gist_id}","starred_url":"https://api.github.com/users/chambridge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chambridge/subscriptions","organizations_url":"https://api.github.com/users/chambridge/orgs","repos_url":"https://api.github.com/users/chambridge/repos","events_url":"https://api.github.com/users/chambridge/events{/privacy}","received_events_url":"https://api.github.com/users/chambridge/received_events","type":"User","site_admin":false},"body":"Tried to make updates based on @blentz version in https://github.com/project-koku/koku/pull/52","created_at":"2018-04-27T14:43:39Z","updated_at":"2018-04-27T15:11:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"343a72592ba91038f3468f16c83bea7fb097e3ce","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/project-koku/koku/pulls/67/commits","review_comments_url":"https://api.github.com/repos/project-koku/koku/pulls/67/comments","review_comment_url":"https://api.github.com/repos/project-koku/koku/pulls/comments{/number}","comments_url":"https://api.github.com/repos/project-koku/koku/issues/67/comments","statuses_url":"https://api.github.com/repos/project-koku/koku/statuses/f51473de258da21d34db5fe3625f2c2ce1786e31","head":{"label":"project-koku:36-status-model","ref":"36-status-model","sha":"f51473de258da21d34db5fe3625f2c2ce1786e31","user":{"login":"project-koku","id":37702693,"avatar_url":"https://avatars1.githubusercontent.com/u/37702693?v=4","gravatar_id":"","url":"https://api.github.com/users/project-koku","html_url":"https://github.com/project-koku","followers_url":"https://api.github.com/users/project-koku/followers","following_url":"https://api.github.com/users/project-koku/following{/other_user}","gists_url":"https://api.github.com/users/project-koku/gists{/gist_id}","starred_url":"https://api.github.com/users/project-koku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-koku/subscriptions","organizations_url":"https://api.github.com/users/project-koku/orgs","repos_url":"https://api.github.com/users/project-koku/repos","events_url":"https://api.github.com/users/project-koku/events{/privacy}","received_events_url":"https://api.github.com/users/project-koku/received_events","type":"Organization","site_admin":false},"repo":{"id":126496611,"name":"koku","full_name":"project-koku/koku","owner":{"login":"project-koku","id":37702693,"avatar_url":"https://avatars1.githubusercontent.com/u/37702693?v=4","gravatar_id":"","url":"https://api.github.com/users/project-koku","html_url":"https://github.com/project-koku","followers_url":"https://api.github.com/users/project-koku/followers","following_url":"https://api.github.com/users/project-koku/following{/other_user}","gists_url":"https://api.github.com/users/project-koku/gists{/gist_id}","starred_url":"https://api.github.com/users/project-koku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-koku/subscriptions","organizations_url":"https://api.github.com/users/project-koku/orgs","repos_url":"https://api.github.com/users/project-koku/repos","events_url":"https://api.github.com/users/project-koku/events{/privacy}","received_events_url":"https://api.github.com/users/project-koku/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/project-koku/koku","description":"An open source solution for cost management of cloud and hybrid cloud environments.","fork":false,"url":"https://api.github.com/repos/project-koku/koku","forks_url":"https://api.github.com/repos/project-koku/koku/forks","keys_url":"https://api.github.com/repos/project-koku/koku/keys{/key_id}","collaborators_url":"https://api.github.com/repos/project-koku/koku/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/project-koku/koku/teams","hooks_url":"https://api.github.com/repos/project-koku/koku/hooks","issue_events_url":"https://api.github.com/repos/project-koku/koku/issues/events{/number}","events_url":"https://api.github.com/repos/project-koku/koku/events","assignees_url":"https://api.github.com/repos/project-koku/koku/assignees{/user}","branches_url":"https://api.github.com/repos/project-koku/koku/branches{/branch}","tags_url":"https://api.github.com/repos/project-koku/koku/tags","blobs_url":"https://api.github.com/repos/project-koku/koku/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/project-koku/koku/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/project-koku/koku/git/refs{/sha}","trees_url":"https://api.github.com/repos/project-koku/koku/git/trees{/sha}","statuses_url":"https://api.github.com/repos/project-koku/koku/statuses/{sha}","languages_url":"https://api.github.com/repos/project-koku/koku/languages","stargazers_url":"https://api.github.com/repos/project-koku/koku/stargazers","contributors_url":"https://api.github.com/repos/project-koku/koku/contributors","subscribers_url":"https://api.github.com/repos/project-koku/koku/subscribers","subscription_url":"https://api.github.com/repos/project-koku/koku/subscription","commits_url":"https://api.github.com/repos/project-koku/koku/commits{/sha}","git_commits_url":"https://api.github.com/repos/project-koku/koku/git/commits{/sha}","comments_url":"https://api.github.com/repos/project-koku/koku/comments{/number}","issue_comment_url":"https://api.github.com/repos/project-koku/koku/issues/comments{/number}","contents_url":"https://api.github.com/repos/project-koku/koku/contents/{+path}","compare_url":"https://api.github.com/repos/project-koku/koku/compare/{base}...{head}","merges_url":"https://api.github.com/repos/project-koku/koku/merges","archive_url":"https://api.github.com/repos/project-koku/koku/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/project-koku/koku/downloads","issues_url":"https://api.github.com/repos/project-koku/koku/issues{/number}","pulls_url":"https://api.github.com/repos/project-koku/koku/pulls{/number}","milestones_url":"https://api.github.com/repos/project-koku/koku/milestones{/number}","notifications_url":"https://api.github.com/repos/project-koku/koku/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/project-koku/koku/labels{/name}","releases_url":"https://api.github.com/repos/project-koku/koku/releases{/id}","deployments_url":"https://api.github.com/repos/project-koku/koku/deployments","created_at":"2018-03-23T14:29:23Z","updated_at":"2018-04-27T15:04:17Z","pushed_at":"2018-04-27T15:04:22Z","git_url":"git://github.com/project-koku/koku.git","ssh_url":"git@github.com:project-koku/koku.git","clone_url":"https://github.com/project-koku/koku.git","svn_url":"https://github.com/project-koku/koku","homepage":"https://koku.readthedocs.io/","size":96,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":22,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":1,"open_issues":22,"watchers":1,"default_branch":"master"}},"base":{"label":"project-koku:master","ref":"master","sha":"04cc909d0a9b129b1ca8449f75b71086713e13d2","user":{"login":"project-koku","id":37702693,"avatar_url":"https://avatars1.githubusercontent.com/u/37702693?v=4","gravatar_id":"","url":"https://api.github.com/users/project-koku","html_url":"https://github.com/project-koku","followers_url":"https://api.github.com/users/project-koku/followers","following_url":"https://api.github.com/users/project-koku/following{/other_user}","gists_url":"https://api.github.com/users/project-koku/gists{/gist_id}","starred_url":"https://api.github.com/users/project-koku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-koku/subscriptions","organizations_url":"https://api.github.com/users/project-koku/orgs","repos_url":"https://api.github.com/users/project-koku/repos","events_url":"https://api.github.com/users/project-koku/events{/privacy}","received_events_url":"https://api.github.com/users/project-koku/received_events","type":"Organization","site_admin":false},"repo":{"id":126496611,"name":"koku","full_name":"project-koku/koku","owner":{"login":"project-koku","id":37702693,"avatar_url":"https://avatars1.githubusercontent.com/u/37702693?v=4","gravatar_id":"","url":"https://api.github.com/users/project-koku","html_url":"https://github.com/project-koku","followers_url":"https://api.github.com/users/project-koku/followers","following_url":"https://api.github.com/users/project-koku/following{/other_user}","gists_url":"https://api.github.com/users/project-koku/gists{/gist_id}","starred_url":"https://api.github.com/users/project-koku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/project-koku/subscriptions","organizations_url":"https://api.github.com/users/project-koku/orgs","repos_url":"https://api.github.com/users/project-koku/repos","events_url":"https://api.github.com/users/project-koku/events{/privacy}","received_events_url":"https://api.github.com/users/project-koku/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/project-koku/koku","description":"An open source solution for cost management of cloud and hybrid cloud environments.","fork":false,"url":"https://api.github.com/repos/project-koku/koku","forks_url":"https://api.github.com/repos/project-koku/koku/forks","keys_url":"https://api.github.com/repos/project-koku/koku/keys{/key_id}","collaborators_url":"https://api.github.com/repos/project-koku/koku/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/project-koku/koku/teams","hooks_url":"https://api.github.com/repos/project-koku/koku/hooks","issue_events_url":"https://api.github.com/repos/project-koku/koku/issues/events{/number}","events_url":"https://api.github.com/repos/project-koku/koku/events","assignees_url":"https://api.github.com/repos/project-koku/koku/assignees{/user}","branches_url":"https://api.github.com/repos/project-koku/koku/branches{/branch}","tags_url":"https://api.github.com/repos/project-koku/koku/tags","blobs_url":"https://api.github.com/repos/project-koku/koku/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/project-koku/koku/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/project-koku/koku/git/refs{/sha}","trees_url":"https://api.github.com/repos/project-koku/koku/git/trees{/sha}","statuses_url":"https://api.github.com/repos/project-koku/koku/statuses/{sha}","languages_url":"https://api.github.com/repos/project-koku/koku/languages","stargazers_url":"https://api.github.com/repos/project-koku/koku/stargazers","contributors_url":"https://api.github.com/repos/project-koku/koku/contributors","subscribers_url":"https://api.github.com/repos/project-koku/koku/subscribers","subscription_url":"https://api.github.com/repos/project-koku/koku/subscription","commits_url":"https://api.github.com/repos/project-koku/koku/commits{/sha}","git_commits_url":"https://api.github.com/repos/project-koku/koku/git/commits{/sha}","comments_url":"https://api.github.com/repos/project-koku/koku/comments{/number}","issue_comment_url":"https://api.github.com/repos/project-koku/koku/issues/comments{/number}","contents_url":"https://api.github.com/repos/project-koku/koku/contents/{+path}","compare_url":"https://api.github.com/repos/project-koku/koku/compare/{base}...{head}","merges_url":"https://api.github.com/repos/project-koku/koku/merges","archive_url":"https://api.github.com/repos/project-koku/koku/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/project-koku/koku/downloads","issues_url":"https://api.github.com/repos/project-koku/koku/issues{/number}","pulls_url":"https://api.github.com/repos/project-koku/koku/pulls{/number}","milestones_url":"https://api.github.com/repos/project-koku/koku/milestones{/number}","notifications_url":"https://api.github.com/repos/project-koku/koku/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/project-koku/koku/labels{/name}","releases_url":"https://api.github.com/repos/project-koku/koku/releases{/id}","deployments_url":"https://api.github.com/repos/project-koku/koku/deployments","created_at":"2018-03-23T14:29:23Z","updated_at":"2018-04-27T15:04:17Z","pushed_at":"2018-04-27T15:04:22Z","git_url":"git://github.com/project-koku/koku.git","ssh_url":"git@github.com:project-koku/koku.git","clone_url":"https://github.com/project-koku/koku.git","svn_url":"https://github.com/project-koku/koku","homepage":"https://koku.readthedocs.io/","size":96,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":22,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":1,"open_issues":22,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/project-koku/koku/pulls/67"},"html":{"href":"https://github.com/project-koku/koku/pull/67"},"issue":{"href":"https://api.github.com/repos/project-koku/koku/issues/67"},"comments":{"href":"https://api.github.com/repos/project-koku/koku/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/project-koku/koku/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/project-koku/koku/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/project-koku/koku/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/project-koku/koku/statuses/f51473de258da21d34db5fe3625f2c2ce1786e31"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"adberglund"}}