{"action":"created","comment":{"url":"https://api.github.com/repos/autotest/autotest-docker/pulls/comments/80032652","id":80032652,"diff_hunk":"@@ -0,0 +1,87 @@\n+\"\"\"\n+Summary\n+-------\n+Testing basic container as systemd service\n+\n+Operational Summary\n+---------------------\n+This is to test container as systemd service using a predefined unit file\n+(``p4321.service``) and a ``script p4321-server.py``. An image is built with\n+this script added. Systemd starts a container using this image & the container\n+writes current time to port ``4321``. From host, the socket is read and the\n+value is checked to see if it is a digit. Finally, container is stopped\n+through systemd and system is cleaned up.\n+\n+\"\"\"\n+\n+import shutil\n+import time\n+import socket\n+from os.path import exists\n+from os import unlink\n+from autotest.client import utils\n+from autotest.client.shared.utils import is_port_free\n+from dockertest.subtest import Subtest\n+from dockertest.dockercmd import DockerCmd\n+from dockertest.images import DockerImages\n+from dockertest.output import mustpass\n+from dockertest.xceptions import DockerTestError\n+\n+\n+class systemd(Subtest):\n+\n+    def initialize(self):\n+        super(systemd, self).initialize()\n+        self.stuff['systemd_touchstone'] = False\n+        unit_file_srcpath = '{}{}'.format(self.bindir, '/p4321.service')\n+        shutil.copyfile(unit_file_srcpath, self.config['sysd_unitf_dest'])\n+        dkrcmd = DockerCmd(self, 'build', ['--force-rm -t',\n+                                           self.config['name'], self.bindir])\n+        mustpass(dkrcmd.execute())\n+\n+    def run_once(self):\n+        host = 'localhost'\n+        port = 4321\n+        self.sysd_action('daemon-reload')\n+        self.sysd_action('start', self.config['sysd_unit_file'])\n+        while is_port_free(port, host):\n+            time.sleep(0.1)\n+        time_from_socket = self.read_socket(host, port)\n+        self.failif(not time_from_socket.isdigit(),\n+                    \"Data received from container is non-numeric: '%s'\"\n+                    % time_from_socket)\n+        self.sysd_action('stop', self.config['sysd_unit_file'])\n+\n+    def cleanup(self):\n+        super(systemd, self).cleanup()\n+        DockerImages(self).clean_all([self.config['name']])","path":"subtests/docker_cli/systemd/systemd.py","position":57,"original_position":57,"commit_id":"5aa888f6df99d377b95d44c24167ee1673721b12","original_commit_id":"5aa888f6df99d377b95d44c24167ee1673721b12","user":{"login":"edsantiago","id":265639,"avatar_url":"https://avatars.githubusercontent.com/u/265639?v=3","gravatar_id":"","url":"https://api.github.com/users/edsantiago","html_url":"https://github.com/edsantiago","followers_url":"https://api.github.com/users/edsantiago/followers","following_url":"https://api.github.com/users/edsantiago/following{/other_user}","gists_url":"https://api.github.com/users/edsantiago/gists{/gist_id}","starred_url":"https://api.github.com/users/edsantiago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edsantiago/subscriptions","organizations_url":"https://api.github.com/users/edsantiago/orgs","repos_url":"https://api.github.com/users/edsantiago/repos","events_url":"https://api.github.com/users/edsantiago/events{/privacy}","received_events_url":"https://api.github.com/users/edsantiago/received_events","type":"User","site_admin":false},"body":"This needs to be moved further down, to after the `stop`. Otherwise the image is removed while a container is still running, which leaves `<none>`s.","created_at":"2016-09-22T12:51:58Z","updated_at":"2016-09-22T12:51:58Z","html_url":"https://github.com/autotest/autotest-docker/pull/636#discussion_r80032652","pull_request_url":"https://api.github.com/repos/autotest/autotest-docker/pulls/636","_links":{"self":{"href":"https://api.github.com/repos/autotest/autotest-docker/pulls/comments/80032652"},"html":{"href":"https://github.com/autotest/autotest-docker/pull/636#discussion_r80032652"},"pull_request":{"href":"https://api.github.com/repos/autotest/autotest-docker/pulls/636"}}},"pull_request":{"url":"https://api.github.com/repos/autotest/autotest-docker/pulls/636","id":84929280,"html_url":"https://github.com/autotest/autotest-docker/pull/636","diff_url":"https://github.com/autotest/autotest-docker/pull/636.diff","patch_url":"https://github.com/autotest/autotest-docker/pull/636.patch","issue_url":"https://api.github.com/repos/autotest/autotest-docker/issues/636","number":636,"state":"open","locked":false,"title":"Adding container as systemd service","user":{"login":"afomm","id":11682503,"avatar_url":"https://avatars.githubusercontent.com/u/11682503?v=3","gravatar_id":"","url":"https://api.github.com/users/afomm","html_url":"https://github.com/afomm","followers_url":"https://api.github.com/users/afomm/followers","following_url":"https://api.github.com/users/afomm/following{/other_user}","gists_url":"https://api.github.com/users/afomm/gists{/gist_id}","starred_url":"https://api.github.com/users/afomm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afomm/subscriptions","organizations_url":"https://api.github.com/users/afomm/orgs","repos_url":"https://api.github.com/users/afomm/repos","events_url":"https://api.github.com/users/afomm/events{/privacy}","received_events_url":"https://api.github.com/users/afomm/received_events","type":"User","site_admin":false},"body":"Adding container as systemd service subtest with static config\r\nA really really rough version\r\n\r\nSigned-off-by: Afom Michael <tmichael@redhat.com>","created_at":"2016-09-12T19:26:00Z","updated_at":"2016-09-22T12:51:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e9a0f97a6448de9d78e92549897e227b8927c793","assignee":{"login":"edsantiago","id":265639,"avatar_url":"https://avatars.githubusercontent.com/u/265639?v=3","gravatar_id":"","url":"https://api.github.com/users/edsantiago","html_url":"https://github.com/edsantiago","followers_url":"https://api.github.com/users/edsantiago/followers","following_url":"https://api.github.com/users/edsantiago/following{/other_user}","gists_url":"https://api.github.com/users/edsantiago/gists{/gist_id}","starred_url":"https://api.github.com/users/edsantiago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edsantiago/subscriptions","organizations_url":"https://api.github.com/users/edsantiago/orgs","repos_url":"https://api.github.com/users/edsantiago/repos","events_url":"https://api.github.com/users/edsantiago/events{/privacy}","received_events_url":"https://api.github.com/users/edsantiago/received_events","type":"User","site_admin":false},"assignees":[{"login":"edsantiago","id":265639,"avatar_url":"https://avatars.githubusercontent.com/u/265639?v=3","gravatar_id":"","url":"https://api.github.com/users/edsantiago","html_url":"https://github.com/edsantiago","followers_url":"https://api.github.com/users/edsantiago/followers","following_url":"https://api.github.com/users/edsantiago/following{/other_user}","gists_url":"https://api.github.com/users/edsantiago/gists{/gist_id}","starred_url":"https://api.github.com/users/edsantiago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edsantiago/subscriptions","organizations_url":"https://api.github.com/users/edsantiago/orgs","repos_url":"https://api.github.com/users/edsantiago/repos","events_url":"https://api.github.com/users/edsantiago/events{/privacy}","received_events_url":"https://api.github.com/users/edsantiago/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/autotest/autotest-docker/milestones/23","html_url":"https://github.com/autotest/autotest-docker/milestones/Docker%20Autotest%20Version%200.8.6%20(NO%20API%20Changes)","labels_url":"https://api.github.com/repos/autotest/autotest-docker/milestones/23/labels","id":1747813,"number":23,"title":"Docker Autotest Version 0.8.6 (NO API Changes)","description":"","creator":{"login":"cevich","id":1183438,"avatar_url":"https://avatars.githubusercontent.com/u/1183438?v=3","gravatar_id":"","url":"https://api.github.com/users/cevich","html_url":"https://github.com/cevich","followers_url":"https://api.github.com/users/cevich/followers","following_url":"https://api.github.com/users/cevich/following{/other_user}","gists_url":"https://api.github.com/users/cevich/gists{/gist_id}","starred_url":"https://api.github.com/users/cevich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cevich/subscriptions","organizations_url":"https://api.github.com/users/cevich/orgs","repos_url":"https://api.github.com/users/cevich/repos","events_url":"https://api.github.com/users/cevich/events{/privacy}","received_events_url":"https://api.github.com/users/cevich/received_events","type":"User","site_admin":false},"open_issues":39,"closed_issues":39,"state":"open","created_at":"2016-05-04T14:28:26Z","updated_at":"2016-09-16T21:22:01Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/autotest/autotest-docker/pulls/636/commits","review_comments_url":"https://api.github.com/repos/autotest/autotest-docker/pulls/636/comments","review_comment_url":"https://api.github.com/repos/autotest/autotest-docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/autotest/autotest-docker/issues/636/comments","statuses_url":"https://api.github.com/repos/autotest/autotest-docker/statuses/5aa888f6df99d377b95d44c24167ee1673721b12","head":{"label":"afomm:afomdev","ref":"afomdev","sha":"5aa888f6df99d377b95d44c24167ee1673721b12","user":{"login":"afomm","id":11682503,"avatar_url":"https://avatars.githubusercontent.com/u/11682503?v=3","gravatar_id":"","url":"https://api.github.com/users/afomm","html_url":"https://github.com/afomm","followers_url":"https://api.github.com/users/afomm/followers","following_url":"https://api.github.com/users/afomm/following{/other_user}","gists_url":"https://api.github.com/users/afomm/gists{/gist_id}","starred_url":"https://api.github.com/users/afomm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afomm/subscriptions","organizations_url":"https://api.github.com/users/afomm/orgs","repos_url":"https://api.github.com/users/afomm/repos","events_url":"https://api.github.com/users/afomm/events{/privacy}","received_events_url":"https://api.github.com/users/afomm/received_events","type":"User","site_admin":false},"repo":{"id":42324192,"name":"autotest-docker","full_name":"afomm/autotest-docker","owner":{"login":"afomm","id":11682503,"avatar_url":"https://avatars.githubusercontent.com/u/11682503?v=3","gravatar_id":"","url":"https://api.github.com/users/afomm","html_url":"https://github.com/afomm","followers_url":"https://api.github.com/users/afomm/followers","following_url":"https://api.github.com/users/afomm/following{/other_user}","gists_url":"https://api.github.com/users/afomm/gists{/gist_id}","starred_url":"https://api.github.com/users/afomm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afomm/subscriptions","organizations_url":"https://api.github.com/users/afomm/orgs","repos_url":"https://api.github.com/users/afomm/repos","events_url":"https://api.github.com/users/afomm/events{/privacy}","received_events_url":"https://api.github.com/users/afomm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/afomm/autotest-docker","description":"Autotest client test containing functional & integration subtests for the Docker project","fork":true,"url":"https://api.github.com/repos/afomm/autotest-docker","forks_url":"https://api.github.com/repos/afomm/autotest-docker/forks","keys_url":"https://api.github.com/repos/afomm/autotest-docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/afomm/autotest-docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/afomm/autotest-docker/teams","hooks_url":"https://api.github.com/repos/afomm/autotest-docker/hooks","issue_events_url":"https://api.github.com/repos/afomm/autotest-docker/issues/events{/number}","events_url":"https://api.github.com/repos/afomm/autotest-docker/events","assignees_url":"https://api.github.com/repos/afomm/autotest-docker/assignees{/user}","branches_url":"https://api.github.com/repos/afomm/autotest-docker/branches{/branch}","tags_url":"https://api.github.com/repos/afomm/autotest-docker/tags","blobs_url":"https://api.github.com/repos/afomm/autotest-docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/afomm/autotest-docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/afomm/autotest-docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/afomm/autotest-docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/afomm/autotest-docker/statuses/{sha}","languages_url":"https://api.github.com/repos/afomm/autotest-docker/languages","stargazers_url":"https://api.github.com/repos/afomm/autotest-docker/stargazers","contributors_url":"https://api.github.com/repos/afomm/autotest-docker/contributors","subscribers_url":"https://api.github.com/repos/afomm/autotest-docker/subscribers","subscription_url":"https://api.github.com/repos/afomm/autotest-docker/subscription","commits_url":"https://api.github.com/repos/afomm/autotest-docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/afomm/autotest-docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/afomm/autotest-docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/afomm/autotest-docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/afomm/autotest-docker/contents/{+path}","compare_url":"https://api.github.com/repos/afomm/autotest-docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/afomm/autotest-docker/merges","archive_url":"https://api.github.com/repos/afomm/autotest-docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/afomm/autotest-docker/downloads","issues_url":"https://api.github.com/repos/afomm/autotest-docker/issues{/number}","pulls_url":"https://api.github.com/repos/afomm/autotest-docker/pulls{/number}","milestones_url":"https://api.github.com/repos/afomm/autotest-docker/milestones{/number}","notifications_url":"https://api.github.com/repos/afomm/autotest-docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/afomm/autotest-docker/labels{/name}","releases_url":"https://api.github.com/repos/afomm/autotest-docker/releases{/id}","deployments_url":"https://api.github.com/repos/afomm/autotest-docker/deployments","created_at":"2015-09-11T18:01:18Z","updated_at":"2016-06-01T19:46:21Z","pushed_at":"2016-09-21T23:20:23Z","git_url":"git://github.com/afomm/autotest-docker.git","ssh_url":"git@github.com:afomm/autotest-docker.git","clone_url":"https://github.com/afomm/autotest-docker.git","svn_url":"https://github.com/afomm/autotest-docker","homepage":null,"size":2253,"stargazers_count":0,"watchers_count":0,"language":"Python","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":0,"default_branch":"master"}},"base":{"label":"autotest:master","ref":"master","sha":"636641ba0f7cf26c5d607899f336a39ce72ffb3e","user":{"login":"autotest","id":472856,"avatar_url":"https://avatars.githubusercontent.com/u/472856?v=3","gravatar_id":"","url":"https://api.github.com/users/autotest","html_url":"https://github.com/autotest","followers_url":"https://api.github.com/users/autotest/followers","following_url":"https://api.github.com/users/autotest/following{/other_user}","gists_url":"https://api.github.com/users/autotest/gists{/gist_id}","starred_url":"https://api.github.com/users/autotest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autotest/subscriptions","organizations_url":"https://api.github.com/users/autotest/orgs","repos_url":"https://api.github.com/users/autotest/repos","events_url":"https://api.github.com/users/autotest/events{/privacy}","received_events_url":"https://api.github.com/users/autotest/received_events","type":"Organization","site_admin":false},"repo":{"id":17869790,"name":"autotest-docker","full_name":"autotest/autotest-docker","owner":{"login":"autotest","id":472856,"avatar_url":"https://avatars.githubusercontent.com/u/472856?v=3","gravatar_id":"","url":"https://api.github.com/users/autotest","html_url":"https://github.com/autotest","followers_url":"https://api.github.com/users/autotest/followers","following_url":"https://api.github.com/users/autotest/following{/other_user}","gists_url":"https://api.github.com/users/autotest/gists{/gist_id}","starred_url":"https://api.github.com/users/autotest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autotest/subscriptions","organizations_url":"https://api.github.com/users/autotest/orgs","repos_url":"https://api.github.com/users/autotest/repos","events_url":"https://api.github.com/users/autotest/events{/privacy}","received_events_url":"https://api.github.com/users/autotest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/autotest/autotest-docker","description":"Autotest client test containing functional & integration subtests for the Docker project","fork":false,"url":"https://api.github.com/repos/autotest/autotest-docker","forks_url":"https://api.github.com/repos/autotest/autotest-docker/forks","keys_url":"https://api.github.com/repos/autotest/autotest-docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/autotest/autotest-docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/autotest/autotest-docker/teams","hooks_url":"https://api.github.com/repos/autotest/autotest-docker/hooks","issue_events_url":"https://api.github.com/repos/autotest/autotest-docker/issues/events{/number}","events_url":"https://api.github.com/repos/autotest/autotest-docker/events","assignees_url":"https://api.github.com/repos/autotest/autotest-docker/assignees{/user}","branches_url":"https://api.github.com/repos/autotest/autotest-docker/branches{/branch}","tags_url":"https://api.github.com/repos/autotest/autotest-docker/tags","blobs_url":"https://api.github.com/repos/autotest/autotest-docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/autotest/autotest-docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/autotest/autotest-docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/autotest/autotest-docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/autotest/autotest-docker/statuses/{sha}","languages_url":"https://api.github.com/repos/autotest/autotest-docker/languages","stargazers_url":"https://api.github.com/repos/autotest/autotest-docker/stargazers","contributors_url":"https://api.github.com/repos/autotest/autotest-docker/contributors","subscribers_url":"https://api.github.com/repos/autotest/autotest-docker/subscribers","subscription_url":"https://api.github.com/repos/autotest/autotest-docker/subscription","commits_url":"https://api.github.com/repos/autotest/autotest-docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/autotest/autotest-docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/autotest/autotest-docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/autotest/autotest-docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/autotest/autotest-docker/contents/{+path}","compare_url":"https://api.github.com/repos/autotest/autotest-docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/autotest/autotest-docker/merges","archive_url":"https://api.github.com/repos/autotest/autotest-docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/autotest/autotest-docker/downloads","issues_url":"https://api.github.com/repos/autotest/autotest-docker/issues{/number}","pulls_url":"https://api.github.com/repos/autotest/autotest-docker/pulls{/number}","milestones_url":"https://api.github.com/repos/autotest/autotest-docker/milestones{/number}","notifications_url":"https://api.github.com/repos/autotest/autotest-docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/autotest/autotest-docker/labels{/name}","releases_url":"https://api.github.com/repos/autotest/autotest-docker/releases{/id}","deployments_url":"https://api.github.com/repos/autotest/autotest-docker/deployments","created_at":"2014-03-18T14:53:27Z","updated_at":"2016-06-28T13:43:29Z","pushed_at":"2016-09-21T23:20:23Z","git_url":"git://github.com/autotest/autotest-docker.git","ssh_url":"git@github.com:autotest/autotest-docker.git","clone_url":"https://github.com/autotest/autotest-docker.git","svn_url":"https://github.com/autotest/autotest-docker","homepage":null,"size":2771,"stargazers_count":13,"watchers_count":13,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":52,"forks":21,"open_issues":52,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/autotest/autotest-docker/pulls/636"},"html":{"href":"https://github.com/autotest/autotest-docker/pull/636"},"issue":{"href":"https://api.github.com/repos/autotest/autotest-docker/issues/636"},"comments":{"href":"https://api.github.com/repos/autotest/autotest-docker/issues/636/comments"},"review_comments":{"href":"https://api.github.com/repos/autotest/autotest-docker/pulls/636/comments"},"review_comment":{"href":"https://api.github.com/repos/autotest/autotest-docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/autotest/autotest-docker/pulls/636/commits"},"statuses":{"href":"https://api.github.com/repos/autotest/autotest-docker/statuses/5aa888f6df99d377b95d44c24167ee1673721b12"}}}}
{"actor":{"display_login":"edsantiago"}}