{"action":"created","comment":{"url":"https://api.github.com/repos/sdelements/sdetools/pulls/comments/31188770","id":31188770,"diff_hunk":"@@ -0,0 +1,95 @@\n+from sdetools.sdelib.cmd import BaseCommand\n+from sdetools.sdelib.commons import Error\n+from sdetools.sdelib.restclient import APIError\n+from sdetools.sdelib.sdeapi import APIBase\n+import sdetools\n+\n+from sdetools.sdelib import log_mgr\n+logger = log_mgr.mods.add_mod(__name__)\n+\n+\n+class Command(BaseCommand):\n+    help = 'Downloads project integration connection details from SDE and executes them as jobs'\n+\n+    def configure(self):\n+        self.api = APIBase(self.config)\n+        self.job_return_msgs = {}\n+        self.config.opts.add('connection_name', \"Connection name\")\n+        self.config.opts.add('frequency', \"Frequency (manual|hourly|daily|weekly|monthly)\")\n+        self.config.opts.add('connection_type', \"Alm connector type\")\n+        self.config.opts.add('params', \"Filter connections based on params such as sde_businessunit or sde_application (key1:value1,key2:value2...)\")\n+        self.config.opts.add('connection_ids', \"Connection ids (1,2,7...)\")\n+\n+    def sde_connect(self):\n+        if not self.api:\n+            raise Error('Requires initialization')\n+        try:\n+            self.api.connect()\n+        except APIError, err:\n+            raise Error('Unable to connect to SD Elements. Please review URL, id,'\n+                    ' and password in configuration file. Reason: %s' % (str(err)))\n+\n+    def filter(self, connections):\n+        filtered_connections = []\n+\n+        for connection in connections:\n+            if self.config['connection_name'] and connection['name'] != self.config['connection_name']:\n+                continue\n+            if self.config['frequency'] and connection['frequency'] != self.config['frequency'] :\n+                continue\n+            if self.config['connection_type'] and connection['type'] != self.config['connection_type']:","path":"sdetools/modules/command_driver.py","position":40,"original_position":40,"commit_id":"6aeed4d9745d549c0da15c61693d920308ae1754","original_commit_id":"6aeed4d9745d549c0da15c61693d920308ae1754","user":{"login":"geoffwhittington","id":1770544,"avatar_url":"https://avatars.githubusercontent.com/u/1770544?v=3","gravatar_id":"","url":"https://api.github.com/users/geoffwhittington","html_url":"https://github.com/geoffwhittington","followers_url":"https://api.github.com/users/geoffwhittington/followers","following_url":"https://api.github.com/users/geoffwhittington/following{/other_user}","gists_url":"https://api.github.com/users/geoffwhittington/gists{/gist_id}","starred_url":"https://api.github.com/users/geoffwhittington/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoffwhittington/subscriptions","organizations_url":"https://api.github.com/users/geoffwhittington/orgs","repos_url":"https://api.github.com/users/geoffwhittington/repos","events_url":"https://api.github.com/users/geoffwhittington/events{/privacy}","received_events_url":"https://api.github.com/users/geoffwhittington/received_events","type":"User","site_admin":false},"body":"We should validate this value in a separate method - similar to what we do here: https://github.com/sdelements/sdetools/blob/master/sdetools/alm_integration/alm_plugin_base.py#L399","created_at":"2015-05-27T22:49:35Z","updated_at":"2015-05-27T22:49:35Z","html_url":"https://github.com/sdelements/sdetools/pull/254#discussion_r31188770","pull_request_url":"https://api.github.com/repos/sdelements/sdetools/pulls/254","_links":{"self":{"href":"https://api.github.com/repos/sdelements/sdetools/pulls/comments/31188770"},"html":{"href":"https://github.com/sdelements/sdetools/pull/254#discussion_r31188770"},"pull_request":{"href":"https://api.github.com/repos/sdelements/sdetools/pulls/254"}}},"pull_request":{"url":"https://api.github.com/repos/sdelements/sdetools/pulls/254","id":36166990,"html_url":"https://github.com/sdelements/sdetools/pull/254","diff_url":"https://github.com/sdelements/sdetools/pull/254.diff","patch_url":"https://github.com/sdelements/sdetools/pull/254.patch","issue_url":"https://api.github.com/repos/sdelements/sdetools/issues/254","number":254,"state":"open","locked":false,"title":"Feature/command driver","user":{"login":"geoffwhittington","id":1770544,"avatar_url":"https://avatars.githubusercontent.com/u/1770544?v=3","gravatar_id":"","url":"https://api.github.com/users/geoffwhittington","html_url":"https://github.com/geoffwhittington","followers_url":"https://api.github.com/users/geoffwhittington/followers","following_url":"https://api.github.com/users/geoffwhittington/following{/other_user}","gists_url":"https://api.github.com/users/geoffwhittington/gists{/gist_id}","starred_url":"https://api.github.com/users/geoffwhittington/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoffwhittington/subscriptions","organizations_url":"https://api.github.com/users/geoffwhittington/orgs","repos_url":"https://api.github.com/users/geoffwhittington/repos","events_url":"https://api.github.com/users/geoffwhittington/events{/privacy}","received_events_url":"https://api.github.com/users/geoffwhittington/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-26T03:19:58Z","updated_at":"2015-05-27T22:49:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"11a3b6ac6b94977c5a6f156e297a8a2439e4da3c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sdelements/sdetools/pulls/254/commits","review_comments_url":"https://api.github.com/repos/sdelements/sdetools/pulls/254/comments","review_comment_url":"https://api.github.com/repos/sdelements/sdetools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sdelements/sdetools/issues/254/comments","statuses_url":"https://api.github.com/repos/sdelements/sdetools/statuses/6aeed4d9745d549c0da15c61693d920308ae1754","head":{"label":"sdelements:feature/command_driver","ref":"feature/command_driver","sha":"6aeed4d9745d549c0da15c61693d920308ae1754","user":{"login":"sdelements","id":739346,"avatar_url":"https://avatars.githubusercontent.com/u/739346?v=3","gravatar_id":"","url":"https://api.github.com/users/sdelements","html_url":"https://github.com/sdelements","followers_url":"https://api.github.com/users/sdelements/followers","following_url":"https://api.github.com/users/sdelements/following{/other_user}","gists_url":"https://api.github.com/users/sdelements/gists{/gist_id}","starred_url":"https://api.github.com/users/sdelements/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdelements/subscriptions","organizations_url":"https://api.github.com/users/sdelements/orgs","repos_url":"https://api.github.com/users/sdelements/repos","events_url":"https://api.github.com/users/sdelements/events{/privacy}","received_events_url":"https://api.github.com/users/sdelements/received_events","type":"Organization","site_admin":false},"repo":{"id":4272561,"name":"sdetools","full_name":"sdelements/sdetools","owner":{"login":"sdelements","id":739346,"avatar_url":"https://avatars.githubusercontent.com/u/739346?v=3","gravatar_id":"","url":"https://api.github.com/users/sdelements","html_url":"https://github.com/sdelements","followers_url":"https://api.github.com/users/sdelements/followers","following_url":"https://api.github.com/users/sdelements/following{/other_user}","gists_url":"https://api.github.com/users/sdelements/gists{/gist_id}","starred_url":"https://api.github.com/users/sdelements/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdelements/subscriptions","organizations_url":"https://api.github.com/users/sdelements/orgs","repos_url":"https://api.github.com/users/sdelements/repos","events_url":"https://api.github.com/users/sdelements/events{/privacy}","received_events_url":"https://api.github.com/users/sdelements/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sdelements/sdetools","description":"SD Element Tools: A collection of SD Elements integration tools built around SD Elements API.","fork":false,"url":"https://api.github.com/repos/sdelements/sdetools","forks_url":"https://api.github.com/repos/sdelements/sdetools/forks","keys_url":"https://api.github.com/repos/sdelements/sdetools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sdelements/sdetools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sdelements/sdetools/teams","hooks_url":"https://api.github.com/repos/sdelements/sdetools/hooks","issue_events_url":"https://api.github.com/repos/sdelements/sdetools/issues/events{/number}","events_url":"https://api.github.com/repos/sdelements/sdetools/events","assignees_url":"https://api.github.com/repos/sdelements/sdetools/assignees{/user}","branches_url":"https://api.github.com/repos/sdelements/sdetools/branches{/branch}","tags_url":"https://api.github.com/repos/sdelements/sdetools/tags","blobs_url":"https://api.github.com/repos/sdelements/sdetools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sdelements/sdetools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sdelements/sdetools/git/refs{/sha}","trees_url":"https://api.github.com/repos/sdelements/sdetools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sdelements/sdetools/statuses/{sha}","languages_url":"https://api.github.com/repos/sdelements/sdetools/languages","stargazers_url":"https://api.github.com/repos/sdelements/sdetools/stargazers","contributors_url":"https://api.github.com/repos/sdelements/sdetools/contributors","subscribers_url":"https://api.github.com/repos/sdelements/sdetools/subscribers","subscription_url":"https://api.github.com/repos/sdelements/sdetools/subscription","commits_url":"https://api.github.com/repos/sdelements/sdetools/commits{/sha}","git_commits_url":"https://api.github.com/repos/sdelements/sdetools/git/commits{/sha}","comments_url":"https://api.github.com/repos/sdelements/sdetools/comments{/number}","issue_comment_url":"https://api.github.com/repos/sdelements/sdetools/issues/comments{/number}","contents_url":"https://api.github.com/repos/sdelements/sdetools/contents/{+path}","compare_url":"https://api.github.com/repos/sdelements/sdetools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sdelements/sdetools/merges","archive_url":"https://api.github.com/repos/sdelements/sdetools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sdelements/sdetools/downloads","issues_url":"https://api.github.com/repos/sdelements/sdetools/issues{/number}","pulls_url":"https://api.github.com/repos/sdelements/sdetools/pulls{/number}","milestones_url":"https://api.github.com/repos/sdelements/sdetools/milestones{/number}","notifications_url":"https://api.github.com/repos/sdelements/sdetools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sdelements/sdetools/labels{/name}","releases_url":"https://api.github.com/repos/sdelements/sdetools/releases{/id}","created_at":"2012-05-09T14:33:34Z","updated_at":"2015-05-20T02:10:03Z","pushed_at":"2015-05-27T21:41:50Z","git_url":"git://github.com/sdelements/sdetools.git","ssh_url":"git@github.com:sdelements/sdetools.git","clone_url":"https://github.com/sdelements/sdetools.git","svn_url":"https://github.com/sdelements/sdetools","homepage":"https://travis-ci.org/sdelements/sdetools","size":13566,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":20,"forks":3,"open_issues":20,"watchers":8,"default_branch":"master"}},"base":{"label":"sdelements:master","ref":"master","sha":"c13670324993e2260c17de08a3073cc6f1a4dd2e","user":{"login":"sdelements","id":739346,"avatar_url":"https://avatars.githubusercontent.com/u/739346?v=3","gravatar_id":"","url":"https://api.github.com/users/sdelements","html_url":"https://github.com/sdelements","followers_url":"https://api.github.com/users/sdelements/followers","following_url":"https://api.github.com/users/sdelements/following{/other_user}","gists_url":"https://api.github.com/users/sdelements/gists{/gist_id}","starred_url":"https://api.github.com/users/sdelements/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdelements/subscriptions","organizations_url":"https://api.github.com/users/sdelements/orgs","repos_url":"https://api.github.com/users/sdelements/repos","events_url":"https://api.github.com/users/sdelements/events{/privacy}","received_events_url":"https://api.github.com/users/sdelements/received_events","type":"Organization","site_admin":false},"repo":{"id":4272561,"name":"sdetools","full_name":"sdelements/sdetools","owner":{"login":"sdelements","id":739346,"avatar_url":"https://avatars.githubusercontent.com/u/739346?v=3","gravatar_id":"","url":"https://api.github.com/users/sdelements","html_url":"https://github.com/sdelements","followers_url":"https://api.github.com/users/sdelements/followers","following_url":"https://api.github.com/users/sdelements/following{/other_user}","gists_url":"https://api.github.com/users/sdelements/gists{/gist_id}","starred_url":"https://api.github.com/users/sdelements/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdelements/subscriptions","organizations_url":"https://api.github.com/users/sdelements/orgs","repos_url":"https://api.github.com/users/sdelements/repos","events_url":"https://api.github.com/users/sdelements/events{/privacy}","received_events_url":"https://api.github.com/users/sdelements/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sdelements/sdetools","description":"SD Element Tools: A collection of SD Elements integration tools built around SD Elements API.","fork":false,"url":"https://api.github.com/repos/sdelements/sdetools","forks_url":"https://api.github.com/repos/sdelements/sdetools/forks","keys_url":"https://api.github.com/repos/sdelements/sdetools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sdelements/sdetools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sdelements/sdetools/teams","hooks_url":"https://api.github.com/repos/sdelements/sdetools/hooks","issue_events_url":"https://api.github.com/repos/sdelements/sdetools/issues/events{/number}","events_url":"https://api.github.com/repos/sdelements/sdetools/events","assignees_url":"https://api.github.com/repos/sdelements/sdetools/assignees{/user}","branches_url":"https://api.github.com/repos/sdelements/sdetools/branches{/branch}","tags_url":"https://api.github.com/repos/sdelements/sdetools/tags","blobs_url":"https://api.github.com/repos/sdelements/sdetools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sdelements/sdetools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sdelements/sdetools/git/refs{/sha}","trees_url":"https://api.github.com/repos/sdelements/sdetools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sdelements/sdetools/statuses/{sha}","languages_url":"https://api.github.com/repos/sdelements/sdetools/languages","stargazers_url":"https://api.github.com/repos/sdelements/sdetools/stargazers","contributors_url":"https://api.github.com/repos/sdelements/sdetools/contributors","subscribers_url":"https://api.github.com/repos/sdelements/sdetools/subscribers","subscription_url":"https://api.github.com/repos/sdelements/sdetools/subscription","commits_url":"https://api.github.com/repos/sdelements/sdetools/commits{/sha}","git_commits_url":"https://api.github.com/repos/sdelements/sdetools/git/commits{/sha}","comments_url":"https://api.github.com/repos/sdelements/sdetools/comments{/number}","issue_comment_url":"https://api.github.com/repos/sdelements/sdetools/issues/comments{/number}","contents_url":"https://api.github.com/repos/sdelements/sdetools/contents/{+path}","compare_url":"https://api.github.com/repos/sdelements/sdetools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sdelements/sdetools/merges","archive_url":"https://api.github.com/repos/sdelements/sdetools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sdelements/sdetools/downloads","issues_url":"https://api.github.com/repos/sdelements/sdetools/issues{/number}","pulls_url":"https://api.github.com/repos/sdelements/sdetools/pulls{/number}","milestones_url":"https://api.github.com/repos/sdelements/sdetools/milestones{/number}","notifications_url":"https://api.github.com/repos/sdelements/sdetools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sdelements/sdetools/labels{/name}","releases_url":"https://api.github.com/repos/sdelements/sdetools/releases{/id}","created_at":"2012-05-09T14:33:34Z","updated_at":"2015-05-20T02:10:03Z","pushed_at":"2015-05-27T21:41:50Z","git_url":"git://github.com/sdelements/sdetools.git","ssh_url":"git@github.com:sdelements/sdetools.git","clone_url":"https://github.com/sdelements/sdetools.git","svn_url":"https://github.com/sdelements/sdetools","homepage":"https://travis-ci.org/sdelements/sdetools","size":13566,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":20,"forks":3,"open_issues":20,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sdelements/sdetools/pulls/254"},"html":{"href":"https://github.com/sdelements/sdetools/pull/254"},"issue":{"href":"https://api.github.com/repos/sdelements/sdetools/issues/254"},"comments":{"href":"https://api.github.com/repos/sdelements/sdetools/issues/254/comments"},"review_comments":{"href":"https://api.github.com/repos/sdelements/sdetools/pulls/254/comments"},"review_comment":{"href":"https://api.github.com/repos/sdelements/sdetools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sdelements/sdetools/pulls/254/commits"},"statuses":{"href":"https://api.github.com/repos/sdelements/sdetools/statuses/6aeed4d9745d549c0da15c61693d920308ae1754"}}}}