{"action":"created","comment":{"url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls/comments/220099469","pull_request_review_id":158425234,"id":220099469,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMDA5OTQ2OQ==","diff_hunk":"@@ -207,12 +145,98 @@\n            type: int\n '''\n \n-from ansible.module_utils.k8svirt.raw import KubeVirtRawModule\n+from ansible.module_utils.k8s.raw import KubernetesRawModule\n+\n+RAW_ARG_SPEC = {\n+    'wait': {'type': 'bool', 'default': True},\n+    'wait_timeout': {'type': 'int', 'default': 20}\n+}\n+\n+class KubeVirtVM(KubernetesRawModule):\n+    def __init__(self, *args, **kwargs):\n+        super(KubeVirtVM, self).__init__(*args, **kwargs)\n+\n+    @property\n+    def argspec(self):\n+        argspec = copy.deepcopy(NAME_ARG_SPEC)\n+        argspec.update(copy.deepcopy(RAW_ARG_SPEC))\n+        return argspec\n+\n+    def execute_module(self):\n+        changed = False\n+        results = []\n+        self.client = self.get_api_client()\n+        wait = self.params.get('wait')\n+        wait_time = self.params.get('wait_timeout')\n+        for definition in self.resource_definitions:\n+            kind = definition.get('kind', self.kind)\n+            search_kind = kind\n+            if kind.lower().endswith('list'):\n+                search_kind = kind[:-4]\n+            api_version = definition.get('apiVersion', self.api_version)\n+            resource = self.find_resource(search_kind, api_version, fail=True)\n+            definition = self.set_defaults(resource, definition)\n+            result = self.perform_action(resource, definition)\n+            changed = changed or result['changed']\n+            if wait and state == 'present' and kind == 'persistent_volume_claim':\n+                w, stream = self._create_stream(resource, namespace, wait_time)\n+                result = self._read_stream(resource, w, stream, name, replicas)\n+            results.append(result)\n+\n+        if len(results) == 1:\n+            self.exit_json(**results[0])\n+\n+        self.exit_json(**{\n+            'changed': changed,\n+            'result': {\n+                'results': results\n+            }\n+        })\n+\n+    # TODO: Candidate to be common method:","path":"lib/ansible/modules/cloud/kubevirt/kubevirt_raw.py","position":177,"original_position":177,"commit_id":"378318a8227404ef068257dfdeb74a443bd56b50","original_commit_id":"378318a8227404ef068257dfdeb74a443bd56b50","user":{"login":"pkliczewski","id":1384786,"node_id":"MDQ6VXNlcjEzODQ3ODY=","avatar_url":"https://avatars1.githubusercontent.com/u/1384786?v=4","gravatar_id":"","url":"https://api.github.com/users/pkliczewski","html_url":"https://github.com/pkliczewski","followers_url":"https://api.github.com/users/pkliczewski/followers","following_url":"https://api.github.com/users/pkliczewski/following{/other_user}","gists_url":"https://api.github.com/users/pkliczewski/gists{/gist_id}","starred_url":"https://api.github.com/users/pkliczewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkliczewski/subscriptions","organizations_url":"https://api.github.com/users/pkliczewski/orgs","repos_url":"https://api.github.com/users/pkliczewski/repos","events_url":"https://api.github.com/users/pkliczewski/events{/privacy}","received_events_url":"https://api.github.com/users/pkliczewski/received_events","type":"User","site_admin":false},"body":"Let's do it in separate PR","created_at":"2018-09-25T08:23:05Z","updated_at":"2018-09-25T08:52:30Z","html_url":"https://github.com/kubevirt/ansible-kubevirt-modules/pull/98#discussion_r220099469","pull_request_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls/98","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls/comments/220099469"},"html":{"href":"https://github.com/kubevirt/ansible-kubevirt-modules/pull/98#discussion_r220099469"},"pull_request":{"href":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls/98"}}},"pull_request":{"url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls/98","id":215580136,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1NTgwMTM2","html_url":"https://github.com/kubevirt/ansible-kubevirt-modules/pull/98","diff_url":"https://github.com/kubevirt/ansible-kubevirt-modules/pull/98.diff","patch_url":"https://github.com/kubevirt/ansible-kubevirt-modules/pull/98.patch","issue_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/issues/98","number":98,"state":"open","locked":false,"title":"Use k8s modules helpers using dynamic client","user":{"login":"machacekondra","id":3384302,"node_id":"MDQ6VXNlcjMzODQzMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/3384302?v=4","gravatar_id":"","url":"https://api.github.com/users/machacekondra","html_url":"https://github.com/machacekondra","followers_url":"https://api.github.com/users/machacekondra/followers","following_url":"https://api.github.com/users/machacekondra/following{/other_user}","gists_url":"https://api.github.com/users/machacekondra/gists{/gist_id}","starred_url":"https://api.github.com/users/machacekondra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/machacekondra/subscriptions","organizations_url":"https://api.github.com/users/machacekondra/orgs","repos_url":"https://api.github.com/users/machacekondra/repos","events_url":"https://api.github.com/users/machacekondra/events{/privacy}","received_events_url":"https://api.github.com/users/machacekondra/received_events","type":"User","site_admin":false},"body":" - Removed few unrelevant tests from `module_utils`, as it's now using k8s `module_utils`, but maybe we still should add some relevant tests for our cases.\r\n - Requires Ansible 2.7 & openshift client 0.6.2\r\n\r\nSigned-off-by: Ondra Machacek <omachace@redhat.com>","created_at":"2018-09-14T12:35:38Z","updated_at":"2018-09-25T08:52:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"908b507ebfe2c4faf3b2ca6fd86a62e250fe3fff","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls/98/commits","review_comments_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls/98/comments","review_comment_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/issues/98/comments","statuses_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/statuses/378318a8227404ef068257dfdeb74a443bd56b50","head":{"label":"machacekondra:dyn_client_with_k8s_support","ref":"dyn_client_with_k8s_support","sha":"378318a8227404ef068257dfdeb74a443bd56b50","user":{"login":"machacekondra","id":3384302,"node_id":"MDQ6VXNlcjMzODQzMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/3384302?v=4","gravatar_id":"","url":"https://api.github.com/users/machacekondra","html_url":"https://github.com/machacekondra","followers_url":"https://api.github.com/users/machacekondra/followers","following_url":"https://api.github.com/users/machacekondra/following{/other_user}","gists_url":"https://api.github.com/users/machacekondra/gists{/gist_id}","starred_url":"https://api.github.com/users/machacekondra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/machacekondra/subscriptions","organizations_url":"https://api.github.com/users/machacekondra/orgs","repos_url":"https://api.github.com/users/machacekondra/repos","events_url":"https://api.github.com/users/machacekondra/events{/privacy}","received_events_url":"https://api.github.com/users/machacekondra/received_events","type":"User","site_admin":false},"repo":{"id":148622471,"node_id":"MDEwOlJlcG9zaXRvcnkxNDg2MjI0NzE=","name":"ansible-kubevirt-modules","full_name":"machacekondra/ansible-kubevirt-modules","private":false,"owner":{"login":"machacekondra","id":3384302,"node_id":"MDQ6VXNlcjMzODQzMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/3384302?v=4","gravatar_id":"","url":"https://api.github.com/users/machacekondra","html_url":"https://github.com/machacekondra","followers_url":"https://api.github.com/users/machacekondra/followers","following_url":"https://api.github.com/users/machacekondra/following{/other_user}","gists_url":"https://api.github.com/users/machacekondra/gists{/gist_id}","starred_url":"https://api.github.com/users/machacekondra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/machacekondra/subscriptions","organizations_url":"https://api.github.com/users/machacekondra/orgs","repos_url":"https://api.github.com/users/machacekondra/repos","events_url":"https://api.github.com/users/machacekondra/events{/privacy}","received_events_url":"https://api.github.com/users/machacekondra/received_events","type":"User","site_admin":false},"html_url":"https://github.com/machacekondra/ansible-kubevirt-modules","description":"Ansible modules for KubeVirt management","fork":true,"url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules","forks_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/forks","keys_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/teams","hooks_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/hooks","issue_events_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/issues/events{/number}","events_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/events","assignees_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/assignees{/user}","branches_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/branches{/branch}","tags_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/tags","blobs_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/git/refs{/sha}","trees_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/statuses/{sha}","languages_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/languages","stargazers_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/stargazers","contributors_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/contributors","subscribers_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/subscribers","subscription_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/subscription","commits_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/commits{/sha}","git_commits_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/git/commits{/sha}","comments_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/comments{/number}","issue_comment_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/issues/comments{/number}","contents_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/contents/{+path}","compare_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/merges","archive_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/downloads","issues_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/issues{/number}","pulls_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/pulls{/number}","milestones_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/milestones{/number}","notifications_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/labels{/name}","releases_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/releases{/id}","deployments_url":"https://api.github.com/repos/machacekondra/ansible-kubevirt-modules/deployments","created_at":"2018-09-13T10:33:04Z","updated_at":"2018-09-13T11:18:02Z","pushed_at":"2018-09-24T14:50:17Z","git_url":"git://github.com/machacekondra/ansible-kubevirt-modules.git","ssh_url":"git@github.com:machacekondra/ansible-kubevirt-modules.git","clone_url":"https://github.com/machacekondra/ansible-kubevirt-modules.git","svn_url":"https://github.com/machacekondra/ansible-kubevirt-modules","homepage":null,"size":139,"stargazers_count":0,"watchers_count":0,"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":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubevirt:master","ref":"master","sha":"e09e08129352c37287a29898709457552f1b8b23","user":{"login":"kubevirt","id":18700703,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4NzAwNzAz","avatar_url":"https://avatars1.githubusercontent.com/u/18700703?v=4","gravatar_id":"","url":"https://api.github.com/users/kubevirt","html_url":"https://github.com/kubevirt","followers_url":"https://api.github.com/users/kubevirt/followers","following_url":"https://api.github.com/users/kubevirt/following{/other_user}","gists_url":"https://api.github.com/users/kubevirt/gists{/gist_id}","starred_url":"https://api.github.com/users/kubevirt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubevirt/subscriptions","organizations_url":"https://api.github.com/users/kubevirt/orgs","repos_url":"https://api.github.com/users/kubevirt/repos","events_url":"https://api.github.com/users/kubevirt/events{/privacy}","received_events_url":"https://api.github.com/users/kubevirt/received_events","type":"Organization","site_admin":false},"repo":{"id":126311840,"node_id":"MDEwOlJlcG9zaXRvcnkxMjYzMTE4NDA=","name":"ansible-kubevirt-modules","full_name":"kubevirt/ansible-kubevirt-modules","private":false,"owner":{"login":"kubevirt","id":18700703,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4NzAwNzAz","avatar_url":"https://avatars1.githubusercontent.com/u/18700703?v=4","gravatar_id":"","url":"https://api.github.com/users/kubevirt","html_url":"https://github.com/kubevirt","followers_url":"https://api.github.com/users/kubevirt/followers","following_url":"https://api.github.com/users/kubevirt/following{/other_user}","gists_url":"https://api.github.com/users/kubevirt/gists{/gist_id}","starred_url":"https://api.github.com/users/kubevirt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubevirt/subscriptions","organizations_url":"https://api.github.com/users/kubevirt/orgs","repos_url":"https://api.github.com/users/kubevirt/repos","events_url":"https://api.github.com/users/kubevirt/events{/privacy}","received_events_url":"https://api.github.com/users/kubevirt/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/kubevirt/ansible-kubevirt-modules","description":"Ansible modules for KubeVirt management","fork":false,"url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules","forks_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/forks","keys_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/teams","hooks_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/hooks","issue_events_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/issues/events{/number}","events_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/events","assignees_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/assignees{/user}","branches_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/branches{/branch}","tags_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/tags","blobs_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/statuses/{sha}","languages_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/languages","stargazers_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/stargazers","contributors_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/contributors","subscribers_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/subscribers","subscription_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/subscription","commits_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/contents/{+path}","compare_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/merges","archive_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/downloads","issues_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/issues{/number}","pulls_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls{/number}","milestones_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/milestones{/number}","notifications_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/labels{/name}","releases_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/releases{/id}","deployments_url":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/deployments","created_at":"2018-03-22T09:33:23Z","updated_at":"2018-09-19T09:27:39Z","pushed_at":"2018-09-24T14:50:19Z","git_url":"git://github.com/kubevirt/ansible-kubevirt-modules.git","ssh_url":"git@github.com:kubevirt/ansible-kubevirt-modules.git","clone_url":"https://github.com/kubevirt/ansible-kubevirt-modules.git","svn_url":"https://github.com/kubevirt/ansible-kubevirt-modules","homepage":null,"size":128,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":9,"open_issues":9,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls/98"},"html":{"href":"https://github.com/kubevirt/ansible-kubevirt-modules/pull/98"},"issue":{"href":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/issues/98"},"comments":{"href":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/issues/98/comments"},"review_comments":{"href":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls/98/comments"},"review_comment":{"href":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/pulls/98/commits"},"statuses":{"href":"https://api.github.com/repos/kubevirt/ansible-kubevirt-modules/statuses/378318a8227404ef068257dfdeb74a443bd56b50"}},"author_association":"NONE"}}
{"actor":{"display_login":"pkliczewski"}}