{"action":"created","comment":{"url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/40247214","id":40247214,"diff_hunk":"@@ -272,3 +306,94 @@ def verify_logfiles(stdout_messages, logfile):\n         d.addCallback(verify_logfiles, logfile=logfile)\n \n         return d\n+\n+\n+class FlockerScriptRunnerJournaldTests(TestCase):\n+    \"\"\"\n+    Functional tests for ``FlockerScriptRunner`` journald support.\n+    \"\"\"\n+    @if_root\n+    @skipUnless(_journald_available(),\n+                \"journald unavailable or inactive on this machine.\")\n+    def run_journald_script(self, script):\n+        \"\"\"\n+        Run a script that logs messages to journald and uses\n+        ``FlockerScriptRunner``.\n+\n+        :param ICommandLineScript: Script to run. Must be class in this module.\n+\n+        :return: ``Deferred`` that fires with decoded JSON messages from the\n+            journal for the process.\n+        \"\"\"\n+        name = random_name(self).encode(\"utf-8\")\n+        code = _SCRIPT_CODE.format(script.__name__, script.__name__)\n+        d = getProcessOutput(\n+            b\"systemd-run\", [b\"--unit=\" + name, b\"--description=testing\",\n+                             sys.executable, b\"-u\", b\"-c\", code,\n+                             b\"--journald\"],\n+            env=os.environ, errortoo=True,\n+        )\n+        d.addCallback(lambda result: msg(\"systemd-run output: \" + result))\n+        # systemd-run doesn't wait for process to exit, so we need to ask\n+        # systemd when it's done:\n+        d.addCallback(lambda _: loop_until(lambda: Popen(\n+            [b\"systemctl\", b\"-q\", b\"is-active\", name]).wait() != 0))","path":"flocker/common/functional/test_script.py","position":148,"original_position":148,"commit_id":"6ab01093494725767102c568ef2c5338ef0024c7","original_commit_id":"6ab01093494725767102c568ef2c5338ef0024c7","user":{"login":"tomprince","id":283816,"avatar_url":"https://avatars.githubusercontent.com/u/283816?v=3","gravatar_id":"","url":"https://api.github.com/users/tomprince","html_url":"https://github.com/tomprince","followers_url":"https://api.github.com/users/tomprince/followers","following_url":"https://api.github.com/users/tomprince/following{/other_user}","gists_url":"https://api.github.com/users/tomprince/gists{/gist_id}","starred_url":"https://api.github.com/users/tomprince/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomprince/subscriptions","organizations_url":"https://api.github.com/users/tomprince/orgs","repos_url":"https://api.github.com/users/tomprince/repos","events_url":"https://api.github.com/users/tomprince/events{/privacy}","received_events_url":"https://api.github.com/users/tomprince/received_events","type":"User","site_admin":false},"body":"The mix of `Popen` and `getProcessOutput` is saddening.","created_at":"2015-09-23T19:35:25Z","updated_at":"2015-09-23T19:35:25Z","html_url":"https://github.com/ClusterHQ/flocker/pull/1968#discussion_r40247214","pull_request_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1968","_links":{"self":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/40247214"},"html":{"href":"https://github.com/ClusterHQ/flocker/pull/1968#discussion_r40247214"},"pull_request":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1968"}}},"pull_request":{"url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1968","id":45702072,"html_url":"https://github.com/ClusterHQ/flocker/pull/1968","diff_url":"https://github.com/ClusterHQ/flocker/pull/1968.diff","patch_url":"https://github.com/ClusterHQ/flocker/pull/1968.patch","issue_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/1968","number":1968,"state":"open","locked":false,"title":"[FLOC-1796] Fix problem where log messages were being wrapped","user":{"login":"itamarst","id":3266662,"avatar_url":"https://avatars.githubusercontent.com/u/3266662?v=3","gravatar_id":"","url":"https://api.github.com/users/itamarst","html_url":"https://github.com/itamarst","followers_url":"https://api.github.com/users/itamarst/followers","following_url":"https://api.github.com/users/itamarst/following{/other_user}","gists_url":"https://api.github.com/users/itamarst/gists{/gist_id}","starred_url":"https://api.github.com/users/itamarst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itamarst/subscriptions","organizations_url":"https://api.github.com/users/itamarst/orgs","repos_url":"https://api.github.com/users/itamarst/repos","events_url":"https://api.github.com/users/itamarst/events{/privacy}","received_events_url":"https://api.github.com/users/itamarst/received_events","type":"User","site_admin":false},"body":"By logging directly using the journald APIs we can avoid a bug where log messages are line wrapped on 2048 byte boundaries. This means log messages will now be much easier to process with tools like `eliot-tree`.\r\n\r\nThe `sleep` in the tests is problematic; not sure what else to do about fact that logging takes a little bit of time to show up in `journalctl` output. Maybe retry a few times?","created_at":"2015-09-22T18:52:34Z","updated_at":"2015-09-23T19:35:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2911db0441361d8eff646cc33fe123710ba7543","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1968/commits","review_comments_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1968/comments","review_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/1968/comments","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/6ab01093494725767102c568ef2c5338ef0024c7","head":{"label":"ClusterHQ:journald-logs-FLOC-1796","ref":"journald-logs-FLOC-1796","sha":"6ab01093494725767102c568ef2c5338ef0024c7","user":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"repo":{"id":19248542,"name":"flocker","full_name":"ClusterHQ/flocker","owner":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ClusterHQ/flocker","description":"Easily manage Docker containers & their data","fork":false,"url":"https://api.github.com/repos/ClusterHQ/flocker","forks_url":"https://api.github.com/repos/ClusterHQ/flocker/forks","keys_url":"https://api.github.com/repos/ClusterHQ/flocker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ClusterHQ/flocker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ClusterHQ/flocker/teams","hooks_url":"https://api.github.com/repos/ClusterHQ/flocker/hooks","issue_events_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/events{/number}","events_url":"https://api.github.com/repos/ClusterHQ/flocker/events","assignees_url":"https://api.github.com/repos/ClusterHQ/flocker/assignees{/user}","branches_url":"https://api.github.com/repos/ClusterHQ/flocker/branches{/branch}","tags_url":"https://api.github.com/repos/ClusterHQ/flocker/tags","blobs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ClusterHQ/flocker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/refs{/sha}","trees_url":"https://api.github.com/repos/ClusterHQ/flocker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/{sha}","languages_url":"https://api.github.com/repos/ClusterHQ/flocker/languages","stargazers_url":"https://api.github.com/repos/ClusterHQ/flocker/stargazers","contributors_url":"https://api.github.com/repos/ClusterHQ/flocker/contributors","subscribers_url":"https://api.github.com/repos/ClusterHQ/flocker/subscribers","subscription_url":"https://api.github.com/repos/ClusterHQ/flocker/subscription","commits_url":"https://api.github.com/repos/ClusterHQ/flocker/commits{/sha}","git_commits_url":"https://api.github.com/repos/ClusterHQ/flocker/git/commits{/sha}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/comments{/number}","issue_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/comments{/number}","contents_url":"https://api.github.com/repos/ClusterHQ/flocker/contents/{+path}","compare_url":"https://api.github.com/repos/ClusterHQ/flocker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ClusterHQ/flocker/merges","archive_url":"https://api.github.com/repos/ClusterHQ/flocker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ClusterHQ/flocker/downloads","issues_url":"https://api.github.com/repos/ClusterHQ/flocker/issues{/number}","pulls_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls{/number}","milestones_url":"https://api.github.com/repos/ClusterHQ/flocker/milestones{/number}","notifications_url":"https://api.github.com/repos/ClusterHQ/flocker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ClusterHQ/flocker/labels{/name}","releases_url":"https://api.github.com/repos/ClusterHQ/flocker/releases{/id}","created_at":"2014-04-28T18:02:14Z","updated_at":"2015-09-23T14:00:59Z","pushed_at":"2015-09-23T19:27:50Z","git_url":"git://github.com/ClusterHQ/flocker.git","ssh_url":"git@github.com:ClusterHQ/flocker.git","clone_url":"https://github.com/ClusterHQ/flocker.git","svn_url":"https://github.com/ClusterHQ/flocker","homepage":"https://clusterhq.com","size":66641,"stargazers_count":1872,"watchers_count":1872,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":132,"mirror_url":null,"open_issues_count":34,"forks":132,"open_issues":34,"watchers":1872,"default_branch":"master"}},"base":{"label":"ClusterHQ:master","ref":"master","sha":"eec408447ef733aff3f28d6596eee79c1989879a","user":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"repo":{"id":19248542,"name":"flocker","full_name":"ClusterHQ/flocker","owner":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ClusterHQ/flocker","description":"Easily manage Docker containers & their data","fork":false,"url":"https://api.github.com/repos/ClusterHQ/flocker","forks_url":"https://api.github.com/repos/ClusterHQ/flocker/forks","keys_url":"https://api.github.com/repos/ClusterHQ/flocker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ClusterHQ/flocker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ClusterHQ/flocker/teams","hooks_url":"https://api.github.com/repos/ClusterHQ/flocker/hooks","issue_events_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/events{/number}","events_url":"https://api.github.com/repos/ClusterHQ/flocker/events","assignees_url":"https://api.github.com/repos/ClusterHQ/flocker/assignees{/user}","branches_url":"https://api.github.com/repos/ClusterHQ/flocker/branches{/branch}","tags_url":"https://api.github.com/repos/ClusterHQ/flocker/tags","blobs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ClusterHQ/flocker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/refs{/sha}","trees_url":"https://api.github.com/repos/ClusterHQ/flocker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/{sha}","languages_url":"https://api.github.com/repos/ClusterHQ/flocker/languages","stargazers_url":"https://api.github.com/repos/ClusterHQ/flocker/stargazers","contributors_url":"https://api.github.com/repos/ClusterHQ/flocker/contributors","subscribers_url":"https://api.github.com/repos/ClusterHQ/flocker/subscribers","subscription_url":"https://api.github.com/repos/ClusterHQ/flocker/subscription","commits_url":"https://api.github.com/repos/ClusterHQ/flocker/commits{/sha}","git_commits_url":"https://api.github.com/repos/ClusterHQ/flocker/git/commits{/sha}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/comments{/number}","issue_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/comments{/number}","contents_url":"https://api.github.com/repos/ClusterHQ/flocker/contents/{+path}","compare_url":"https://api.github.com/repos/ClusterHQ/flocker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ClusterHQ/flocker/merges","archive_url":"https://api.github.com/repos/ClusterHQ/flocker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ClusterHQ/flocker/downloads","issues_url":"https://api.github.com/repos/ClusterHQ/flocker/issues{/number}","pulls_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls{/number}","milestones_url":"https://api.github.com/repos/ClusterHQ/flocker/milestones{/number}","notifications_url":"https://api.github.com/repos/ClusterHQ/flocker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ClusterHQ/flocker/labels{/name}","releases_url":"https://api.github.com/repos/ClusterHQ/flocker/releases{/id}","created_at":"2014-04-28T18:02:14Z","updated_at":"2015-09-23T14:00:59Z","pushed_at":"2015-09-23T19:27:50Z","git_url":"git://github.com/ClusterHQ/flocker.git","ssh_url":"git@github.com:ClusterHQ/flocker.git","clone_url":"https://github.com/ClusterHQ/flocker.git","svn_url":"https://github.com/ClusterHQ/flocker","homepage":"https://clusterhq.com","size":66641,"stargazers_count":1872,"watchers_count":1872,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":132,"mirror_url":null,"open_issues_count":34,"forks":132,"open_issues":34,"watchers":1872,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1968"},"html":{"href":"https://github.com/ClusterHQ/flocker/pull/1968"},"issue":{"href":"https://api.github.com/repos/ClusterHQ/flocker/issues/1968"},"comments":{"href":"https://api.github.com/repos/ClusterHQ/flocker/issues/1968/comments"},"review_comments":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1968/comments"},"review_comment":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1968/commits"},"statuses":{"href":"https://api.github.com/repos/ClusterHQ/flocker/statuses/6ab01093494725767102c568ef2c5338ef0024c7"}}}}