{"action":"created","comment":{"url":"https://api.github.com/repos/user-cont/conu/pulls/comments/233890885","pull_request_review_id":175409357,"id":233890885,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzg5MDg4NQ==","diff_hunk":"@@ -0,0 +1,152 @@\n+# -*- coding: utf-8 -*-\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 3 of the License, or\n+# (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 General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+#\n+\n+\"\"\"\n+This is backend for podman engine\n+\"\"\"\n+import logging\n+\n+from conu.apidefs.backend import Backend\n+from conu.backend.podman.container import PodmanContainer\n+from conu.backend.podman.image import PodmanImage, PodmanImagePullPolicy\n+from conu.backend.podman.constants import CONU_ARTIFACT_TAG\n+from conu.backend.podman.utils import inspect_to_metadata, inspect_to_container_metadata, graceful_get\n+\n+\n+from conu.utils import run_cmd\n+\n+logger = logging.getLogger(__name__)\n+\n+\n+def parse_reference(reference):\n+    \"\"\"\n+    parse provided image reference into <image_repository>:<tag>\n+\n+    :param reference: str, e.g. (registry.fedoraproject.org/fedora:27)\n+    :return: collection (tuple or list), (\"registry.fedoraproject.org/fedora\", \"27\")\n+    \"\"\"\n+    if \":\" in reference:\n+        im, tag = reference.rsplit(\":\", 1)\n+        if \"/\" in tag:\n+            # this is case when there is port in the registry URI\n+            return (reference, \"latest\")\n+        else:\n+            return (im, tag)\n+\n+    else:\n+        return (reference, \"latest\")\n+\n+\n+class PodmanBackend(Backend):\n+    \"\"\"\n+    For more info on using the Backend classes, see documentation of\n+    the parent :class:`conu.apidefs.backend.Backend` class.\n+    \"\"\"\n+    name = \"podman\"\n+    ContainerClass = PodmanContainer\n+    ImageClass = PodmanImage\n+\n+    def __init__(self, logging_level=logging.INFO, logging_kwargs=None, cleanup=None):\n+        \"\"\"\n+        This method serves as a configuration interface for conu.\n+\n+        :param logging_level: int, control logger verbosity: see logging.{DEBUG,INFO,ERROR}\n+        :param logging_kwargs: dict, additional keyword arguments for logger set up, for more info\n+                                see docstring of set_logging function\n+        :param cleanup: list, list of cleanup policy values, examples:\n+            - [CleanupPolicy.EVERYTHING]\n+            - [CleanupPolicy.VOLUMES, CleanupPolicy.TMP_DIRS]\n+            - [CleanupPolicy.NOTHING]\n+        \"\"\"\n+\n+        super(PodmanBackend, self).__init__(\n+            logging_level=logging_level, logging_kwargs=logging_kwargs, cleanup=cleanup)\n+\n+    def cleanup_containers(self):\n+        # TODO: Test this\n+        conu_containers = self._list_podman_containers(filter=CONU_ARTIFACT_TAG)\n+        for c in conu_containers:\n+            logger.info(\"Trying to remove conu container: %s\" % c)\n+            logger.debug(\"Removing container %s created by conu\", c)\n+            run_cmd([\"podman\", \"stop\", c])\n+            run_cmd([\"podman\", \"rm\", c])\n+\n+    def list_containers(self):\n+        \"\"\"\n+        List all available podman containers.\n+\n+        :return: collection of instances of :class:`conu.PodmanContainer`\n+        \"\"\"\n+        containers = []\n+        for identifier in self._list_podman_containers():\n+            inspect_data = PodmanContainer._inspect(identifier)\n+            name = graceful_get(inspect_data, \"Name\")\n+            image_id = graceful_get(inspect_data, \"ImageID\")\n+\n+            try:\n+                image_name, image_tag = parse_reference(inspect_data[\"ImageName\"])\n+            except (IndexError, TypeError):\n+                image_name, image_tag = None, None\n+\n+            image = PodmanImage(image_name, tag=image_tag, identifier=image_id)\n+            container = PodmanContainer(image, identifier, name=name)\n+            inspect_to_container_metadata(container.metadata, inspect_data, image)\n+            containers.append(container)\n+\n+        return containers\n+\n+    def list_images(self):","path":"conu/backend/podman/backend.py","position":111,"original_position":111,"commit_id":"ba8741832cda368a3ca3bbc6bd94ab821745aaa8","original_commit_id":"ba8741832cda368a3ca3bbc6bd94ab821745aaa8","user":{"login":"lachmanfrantisek","id":20214043,"node_id":"MDQ6VXNlcjIwMjE0MDQz","avatar_url":"https://avatars1.githubusercontent.com/u/20214043?v=4","gravatar_id":"","url":"https://api.github.com/users/lachmanfrantisek","html_url":"https://github.com/lachmanfrantisek","followers_url":"https://api.github.com/users/lachmanfrantisek/followers","following_url":"https://api.github.com/users/lachmanfrantisek/following{/other_user}","gists_url":"https://api.github.com/users/lachmanfrantisek/gists{/gist_id}","starred_url":"https://api.github.com/users/lachmanfrantisek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lachmanfrantisek/subscriptions","organizations_url":"https://api.github.com/users/lachmanfrantisek/orgs","repos_url":"https://api.github.com/users/lachmanfrantisek/repos","events_url":"https://api.github.com/users/lachmanfrantisek/events{/privacy}","received_events_url":"https://api.github.com/users/lachmanfrantisek/received_events","type":"User","site_admin":false},"body":"This can help:\r\n```\r\npodman images --format json\r\n```","created_at":"2018-11-15T15:33:38Z","updated_at":"2018-11-15T15:33:39Z","html_url":"https://github.com/user-cont/conu/pull/298#discussion_r233890885","pull_request_url":"https://api.github.com/repos/user-cont/conu/pulls/298","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/user-cont/conu/pulls/comments/233890885"},"html":{"href":"https://github.com/user-cont/conu/pull/298#discussion_r233890885"},"pull_request":{"href":"https://api.github.com/repos/user-cont/conu/pulls/298"}},"in_reply_to_id":233536736},"pull_request":{"url":"https://api.github.com/repos/user-cont/conu/pulls/298","id":224433150,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0NDMzMTUw","html_url":"https://github.com/user-cont/conu/pull/298","diff_url":"https://github.com/user-cont/conu/pull/298.diff","patch_url":"https://github.com/user-cont/conu/pull/298.patch","issue_url":"https://api.github.com/repos/user-cont/conu/issues/298","number":298,"state":"open","locked":false,"title":"[WIP] libpod/podman backend #200","user":{"login":"fasashen","id":7330350,"node_id":"MDQ6VXNlcjczMzAzNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/7330350?v=4","gravatar_id":"","url":"https://api.github.com/users/fasashen","html_url":"https://github.com/fasashen","followers_url":"https://api.github.com/users/fasashen/followers","following_url":"https://api.github.com/users/fasashen/following{/other_user}","gists_url":"https://api.github.com/users/fasashen/gists{/gist_id}","starred_url":"https://api.github.com/users/fasashen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fasashen/subscriptions","organizations_url":"https://api.github.com/users/fasashen/orgs","repos_url":"https://api.github.com/users/fasashen/repos","events_url":"https://api.github.com/users/fasashen/events{/privacy}","received_events_url":"https://api.github.com/users/fasashen/received_events","type":"User","site_admin":false},"body":"PodmanBackend implementation based on DockerBackend\r\n\r\nAt this moment  a few basic features of podman's backend are implemented, that pass tests:\r\n- PodmanImage: inspect, tag, remove\r\n- PodmanContainer: inspect, run (only with --privileged), delete\r\n- and vagrant configuration to prepare an environment\r\n\r\nTested inside vagrant's VM.\r\nThere is an unsolved issue: podman's container doesn't run with no --privileged flag, throwing status Exited (139).\r\n\r\nPart of [Red Hat Open Source Contest](https://research.redhat.com/red-hat-open-source-contest/)","created_at":"2018-10-19T23:22:47Z","updated_at":"2018-11-15T15:33:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6049f2ef204061aec8456078d28bf72906fc6b33","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/user-cont/conu/pulls/298/commits","review_comments_url":"https://api.github.com/repos/user-cont/conu/pulls/298/comments","review_comment_url":"https://api.github.com/repos/user-cont/conu/pulls/comments{/number}","comments_url":"https://api.github.com/repos/user-cont/conu/issues/298/comments","statuses_url":"https://api.github.com/repos/user-cont/conu/statuses/ba8741832cda368a3ca3bbc6bd94ab821745aaa8","head":{"label":"fasashen:podman","ref":"podman","sha":"ba8741832cda368a3ca3bbc6bd94ab821745aaa8","user":{"login":"fasashen","id":7330350,"node_id":"MDQ6VXNlcjczMzAzNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/7330350?v=4","gravatar_id":"","url":"https://api.github.com/users/fasashen","html_url":"https://github.com/fasashen","followers_url":"https://api.github.com/users/fasashen/followers","following_url":"https://api.github.com/users/fasashen/following{/other_user}","gists_url":"https://api.github.com/users/fasashen/gists{/gist_id}","starred_url":"https://api.github.com/users/fasashen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fasashen/subscriptions","organizations_url":"https://api.github.com/users/fasashen/orgs","repos_url":"https://api.github.com/users/fasashen/repos","events_url":"https://api.github.com/users/fasashen/events{/privacy}","received_events_url":"https://api.github.com/users/fasashen/received_events","type":"User","site_admin":false},"repo":{"id":150593221,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA1OTMyMjE=","name":"conu","full_name":"fasashen/conu","private":false,"owner":{"login":"fasashen","id":7330350,"node_id":"MDQ6VXNlcjczMzAzNTA=","avatar_url":"https://avatars0.githubusercontent.com/u/7330350?v=4","gravatar_id":"","url":"https://api.github.com/users/fasashen","html_url":"https://github.com/fasashen","followers_url":"https://api.github.com/users/fasashen/followers","following_url":"https://api.github.com/users/fasashen/following{/other_user}","gists_url":"https://api.github.com/users/fasashen/gists{/gist_id}","starred_url":"https://api.github.com/users/fasashen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fasashen/subscriptions","organizations_url":"https://api.github.com/users/fasashen/orgs","repos_url":"https://api.github.com/users/fasashen/repos","events_url":"https://api.github.com/users/fasashen/events{/privacy}","received_events_url":"https://api.github.com/users/fasashen/received_events","type":"User","site_admin":false},"html_url":"https://github.com/fasashen/conu","description":"conu - python API for your containers","fork":true,"url":"https://api.github.com/repos/fasashen/conu","forks_url":"https://api.github.com/repos/fasashen/conu/forks","keys_url":"https://api.github.com/repos/fasashen/conu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fasashen/conu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fasashen/conu/teams","hooks_url":"https://api.github.com/repos/fasashen/conu/hooks","issue_events_url":"https://api.github.com/repos/fasashen/conu/issues/events{/number}","events_url":"https://api.github.com/repos/fasashen/conu/events","assignees_url":"https://api.github.com/repos/fasashen/conu/assignees{/user}","branches_url":"https://api.github.com/repos/fasashen/conu/branches{/branch}","tags_url":"https://api.github.com/repos/fasashen/conu/tags","blobs_url":"https://api.github.com/repos/fasashen/conu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fasashen/conu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fasashen/conu/git/refs{/sha}","trees_url":"https://api.github.com/repos/fasashen/conu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fasashen/conu/statuses/{sha}","languages_url":"https://api.github.com/repos/fasashen/conu/languages","stargazers_url":"https://api.github.com/repos/fasashen/conu/stargazers","contributors_url":"https://api.github.com/repos/fasashen/conu/contributors","subscribers_url":"https://api.github.com/repos/fasashen/conu/subscribers","subscription_url":"https://api.github.com/repos/fasashen/conu/subscription","commits_url":"https://api.github.com/repos/fasashen/conu/commits{/sha}","git_commits_url":"https://api.github.com/repos/fasashen/conu/git/commits{/sha}","comments_url":"https://api.github.com/repos/fasashen/conu/comments{/number}","issue_comment_url":"https://api.github.com/repos/fasashen/conu/issues/comments{/number}","contents_url":"https://api.github.com/repos/fasashen/conu/contents/{+path}","compare_url":"https://api.github.com/repos/fasashen/conu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fasashen/conu/merges","archive_url":"https://api.github.com/repos/fasashen/conu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fasashen/conu/downloads","issues_url":"https://api.github.com/repos/fasashen/conu/issues{/number}","pulls_url":"https://api.github.com/repos/fasashen/conu/pulls{/number}","milestones_url":"https://api.github.com/repos/fasashen/conu/milestones{/number}","notifications_url":"https://api.github.com/repos/fasashen/conu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fasashen/conu/labels{/name}","releases_url":"https://api.github.com/repos/fasashen/conu/releases{/id}","deployments_url":"https://api.github.com/repos/fasashen/conu/deployments","created_at":"2018-09-27T13:42:32Z","updated_at":"2018-10-18T08:46:06Z","pushed_at":"2018-11-12T12:55:52Z","git_url":"git://github.com/fasashen/conu.git","ssh_url":"git@github.com:fasashen/conu.git","clone_url":"https://github.com/fasashen/conu.git","svn_url":"https://github.com/fasashen/conu","homepage":"http://conu.readthedocs.io/en/latest/","size":2423,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"user-cont:master","ref":"master","sha":"5892c11743437a6c198120b910bc0a38b5812a1a","user":{"login":"user-cont","id":35456931,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NDU2OTMx","avatar_url":"https://avatars1.githubusercontent.com/u/35456931?v=4","gravatar_id":"","url":"https://api.github.com/users/user-cont","html_url":"https://github.com/user-cont","followers_url":"https://api.github.com/users/user-cont/followers","following_url":"https://api.github.com/users/user-cont/following{/other_user}","gists_url":"https://api.github.com/users/user-cont/gists{/gist_id}","starred_url":"https://api.github.com/users/user-cont/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/user-cont/subscriptions","organizations_url":"https://api.github.com/users/user-cont/orgs","repos_url":"https://api.github.com/users/user-cont/repos","events_url":"https://api.github.com/users/user-cont/events{/privacy}","received_events_url":"https://api.github.com/users/user-cont/received_events","type":"Organization","site_admin":false},"repo":{"id":103242244,"node_id":"MDEwOlJlcG9zaXRvcnkxMDMyNDIyNDQ=","name":"conu","full_name":"user-cont/conu","private":false,"owner":{"login":"user-cont","id":35456931,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NDU2OTMx","avatar_url":"https://avatars1.githubusercontent.com/u/35456931?v=4","gravatar_id":"","url":"https://api.github.com/users/user-cont","html_url":"https://github.com/user-cont","followers_url":"https://api.github.com/users/user-cont/followers","following_url":"https://api.github.com/users/user-cont/following{/other_user}","gists_url":"https://api.github.com/users/user-cont/gists{/gist_id}","starred_url":"https://api.github.com/users/user-cont/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/user-cont/subscriptions","organizations_url":"https://api.github.com/users/user-cont/orgs","repos_url":"https://api.github.com/users/user-cont/repos","events_url":"https://api.github.com/users/user-cont/events{/privacy}","received_events_url":"https://api.github.com/users/user-cont/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/user-cont/conu","description":"conu - python API for your containers","fork":false,"url":"https://api.github.com/repos/user-cont/conu","forks_url":"https://api.github.com/repos/user-cont/conu/forks","keys_url":"https://api.github.com/repos/user-cont/conu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/user-cont/conu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/user-cont/conu/teams","hooks_url":"https://api.github.com/repos/user-cont/conu/hooks","issue_events_url":"https://api.github.com/repos/user-cont/conu/issues/events{/number}","events_url":"https://api.github.com/repos/user-cont/conu/events","assignees_url":"https://api.github.com/repos/user-cont/conu/assignees{/user}","branches_url":"https://api.github.com/repos/user-cont/conu/branches{/branch}","tags_url":"https://api.github.com/repos/user-cont/conu/tags","blobs_url":"https://api.github.com/repos/user-cont/conu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/user-cont/conu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/user-cont/conu/git/refs{/sha}","trees_url":"https://api.github.com/repos/user-cont/conu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/user-cont/conu/statuses/{sha}","languages_url":"https://api.github.com/repos/user-cont/conu/languages","stargazers_url":"https://api.github.com/repos/user-cont/conu/stargazers","contributors_url":"https://api.github.com/repos/user-cont/conu/contributors","subscribers_url":"https://api.github.com/repos/user-cont/conu/subscribers","subscription_url":"https://api.github.com/repos/user-cont/conu/subscription","commits_url":"https://api.github.com/repos/user-cont/conu/commits{/sha}","git_commits_url":"https://api.github.com/repos/user-cont/conu/git/commits{/sha}","comments_url":"https://api.github.com/repos/user-cont/conu/comments{/number}","issue_comment_url":"https://api.github.com/repos/user-cont/conu/issues/comments{/number}","contents_url":"https://api.github.com/repos/user-cont/conu/contents/{+path}","compare_url":"https://api.github.com/repos/user-cont/conu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/user-cont/conu/merges","archive_url":"https://api.github.com/repos/user-cont/conu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/user-cont/conu/downloads","issues_url":"https://api.github.com/repos/user-cont/conu/issues{/number}","pulls_url":"https://api.github.com/repos/user-cont/conu/pulls{/number}","milestones_url":"https://api.github.com/repos/user-cont/conu/milestones{/number}","notifications_url":"https://api.github.com/repos/user-cont/conu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/user-cont/conu/labels{/name}","releases_url":"https://api.github.com/repos/user-cont/conu/releases{/id}","deployments_url":"https://api.github.com/repos/user-cont/conu/deployments","created_at":"2017-09-12T08:14:37Z","updated_at":"2018-11-15T09:50:35Z","pushed_at":"2018-11-15T13:05:20Z","git_url":"git://github.com/user-cont/conu.git","ssh_url":"git@github.com:user-cont/conu.git","clone_url":"https://github.com/user-cont/conu.git","svn_url":"https://github.com/user-cont/conu","homepage":"http://conu.readthedocs.io/en/latest/","size":2412,"stargazers_count":109,"watchers_count":109,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"archived":false,"open_issues_count":25,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":23,"open_issues":25,"watchers":109,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/user-cont/conu/pulls/298"},"html":{"href":"https://github.com/user-cont/conu/pull/298"},"issue":{"href":"https://api.github.com/repos/user-cont/conu/issues/298"},"comments":{"href":"https://api.github.com/repos/user-cont/conu/issues/298/comments"},"review_comments":{"href":"https://api.github.com/repos/user-cont/conu/pulls/298/comments"},"review_comment":{"href":"https://api.github.com/repos/user-cont/conu/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/user-cont/conu/pulls/298/commits"},"statuses":{"href":"https://api.github.com/repos/user-cont/conu/statuses/ba8741832cda368a3ca3bbc6bd94ab821745aaa8"}},"author_association":"NONE"}}
{"actor":{"display_login":"lachmanfrantisek"}}