{"action":"created","comment":{"url":"https://api.github.com/repos/greenqloud/cloudstack/pulls/comments/81563019","pull_request_review_id":2533724,"id":81563019,"diff_hunk":"@@ -0,0 +1,68 @@\n+# Meant to be run by nose tests in a virtualenv.\n+#\n+# Steps:\n+# - The test data is inserted (see test_dataset.sql)\n+# - The migration code is run\n+# - The data is verified\n+# - The test data is deleted\n+\n+import cspyclient\n+import MySQLdb\n+import MySQLdb.cursors\n+import os\n+import subprocess\n+from nose.tools import assert_equal, assert_not_equal, assert_true\n+\n+MIGRATIONS_DIR =  os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,\n+                                               'upgradescripts', '4.2.1-4.7.2'))\n+import sys\n+sys.path.append(MIGRATIONS_DIR)\n+from pre_install import PreInstall\n+\n+MYSQL_HOST = '127.0.0.1'\n+MYSQL_USER = 'root'\n+MYSQL_PW = ''\n+MYSQL_PORT=3306\n+DB = 'cloud' # must be this, as pre_install.py hardcodes this value.\n+\n+cursor = None\n+\n+def setup_module():\n+    global cursor\n+    cursor = MySQLdb.connect(host=MYSQL_HOST, user=MYSQL_USER, passwd=MYSQL_PW, cursorclass=MySQLdb.cursors.DictCursor).cursor()\n+\n+    cursor.execute(\"drop database if exists %s\" % DB)\n+    cursor.execute(\"create database %s\" % DB)\n+\n+    sql_scripts = [\n+        os.path.abspath(os.path.join(os.path.dirname(__file__), 'test_dataset.sql'))\n+    ]\n+\n+    for script in sql_scripts:\n+        cmd = [\"mysql\", \"-u\", MYSQL_USER]\n+        if MYSQL_PW != '':\n+            cmd += [\"-p%s\" % MYSQL_PW]\n+        cmd += [DB]\n+\n+        f = open(script)\n+        subprocess.call(cmd, stdin=f)\n+\n+\n+    # attempt to run the python script\n+    pi = PreInstall(\"\", \"\", \"\", MYSQL_HOST, MYSQL_USER, MYSQL_PW, MYSQL_PORT)\n+    pi.cleanup_security_groups_providers()\n+\n+    True\n+\n+def teardown_module():\n+    cursor.execute(\"drop database if exists %s\" % DB)","path":"test/upgradescripts/test_migration.py","position":58,"original_position":58,"commit_id":"415a946a90e2a8715e2f028d8dc429551953746a","original_commit_id":"415a946a90e2a8715e2f028d8dc429551953746a","user":{"login":"HrWiggles","id":12530748,"avatar_url":"https://avatars.githubusercontent.com/u/12530748?v=3","gravatar_id":"","url":"https://api.github.com/users/HrWiggles","html_url":"https://github.com/HrWiggles","followers_url":"https://api.github.com/users/HrWiggles/followers","following_url":"https://api.github.com/users/HrWiggles/following{/other_user}","gists_url":"https://api.github.com/users/HrWiggles/gists{/gist_id}","starred_url":"https://api.github.com/users/HrWiggles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HrWiggles/subscriptions","organizations_url":"https://api.github.com/users/HrWiggles/orgs","repos_url":"https://api.github.com/users/HrWiggles/repos","events_url":"https://api.github.com/users/HrWiggles/events{/privacy}","received_events_url":"https://api.github.com/users/HrWiggles/received_events","type":"User","site_admin":false},"body":"Should there not be a check for whether `cursor` is `None`? (and then only do `drop database ...` and `cursor.close()` if it isn't `None`)","created_at":"2016-10-03T14:37:19Z","updated_at":"2016-10-03T14:41:58Z","html_url":"https://github.com/greenqloud/cloudstack/pull/124#discussion_r81563019","pull_request_url":"https://api.github.com/repos/greenqloud/cloudstack/pulls/124","_links":{"self":{"href":"https://api.github.com/repos/greenqloud/cloudstack/pulls/comments/81563019"},"html":{"href":"https://github.com/greenqloud/cloudstack/pull/124#discussion_r81563019"},"pull_request":{"href":"https://api.github.com/repos/greenqloud/cloudstack/pulls/124"}}},"pull_request":{"url":"https://api.github.com/repos/greenqloud/cloudstack/pulls/124","id":87725999,"html_url":"https://github.com/greenqloud/cloudstack/pull/124","diff_url":"https://github.com/greenqloud/cloudstack/pull/124.diff","patch_url":"https://github.com/greenqloud/cloudstack/pull/124.patch","issue_url":"https://api.github.com/repos/greenqloud/cloudstack/issues/124","number":124,"state":"open","locked":false,"title":"Delete VirtualRouterSG out during 4.2 -> 4.7 upgrade.","user":{"login":"ProjectMoon","id":183856,"avatar_url":"https://avatars.githubusercontent.com/u/183856?v=3","gravatar_id":"","url":"https://api.github.com/users/ProjectMoon","html_url":"https://github.com/ProjectMoon","followers_url":"https://api.github.com/users/ProjectMoon/followers","following_url":"https://api.github.com/users/ProjectMoon/following{/other_user}","gists_url":"https://api.github.com/users/ProjectMoon/gists{/gist_id}","starred_url":"https://api.github.com/users/ProjectMoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProjectMoon/subscriptions","organizations_url":"https://api.github.com/users/ProjectMoon/orgs","repos_url":"https://api.github.com/users/ProjectMoon/repos","events_url":"https://api.github.com/users/ProjectMoon/events{/privacy}","received_events_url":"https://api.github.com/users/ProjectMoon/received_events","type":"User","site_admin":false},"body":"Completely removes our old hacky security groups provider, covering the tables that were forgotten in the initial development of the script.","created_at":"2016-10-03T14:26:44Z","updated_at":"2016-10-03T14:41:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6dab8a38a20b3a1c77a822637723e1fdd78f4d8c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/greenqloud/cloudstack/pulls/124/commits","review_comments_url":"https://api.github.com/repos/greenqloud/cloudstack/pulls/124/comments","review_comment_url":"https://api.github.com/repos/greenqloud/cloudstack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/greenqloud/cloudstack/issues/124/comments","statuses_url":"https://api.github.com/repos/greenqloud/cloudstack/statuses/415a946a90e2a8715e2f028d8dc429551953746a","head":{"label":"greenqloud:upgrade-delete-more-stuff","ref":"upgrade-delete-more-stuff","sha":"415a946a90e2a8715e2f028d8dc429551953746a","user":{"login":"greenqloud","id":228758,"avatar_url":"https://avatars.githubusercontent.com/u/228758?v=3","gravatar_id":"","url":"https://api.github.com/users/greenqloud","html_url":"https://github.com/greenqloud","followers_url":"https://api.github.com/users/greenqloud/followers","following_url":"https://api.github.com/users/greenqloud/following{/other_user}","gists_url":"https://api.github.com/users/greenqloud/gists{/gist_id}","starred_url":"https://api.github.com/users/greenqloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenqloud/subscriptions","organizations_url":"https://api.github.com/users/greenqloud/orgs","repos_url":"https://api.github.com/users/greenqloud/repos","events_url":"https://api.github.com/users/greenqloud/events{/privacy}","received_events_url":"https://api.github.com/users/greenqloud/received_events","type":"Organization","site_admin":false},"repo":{"id":36817746,"name":"cloudstack","full_name":"greenqloud/cloudstack","owner":{"login":"greenqloud","id":228758,"avatar_url":"https://avatars.githubusercontent.com/u/228758?v=3","gravatar_id":"","url":"https://api.github.com/users/greenqloud","html_url":"https://github.com/greenqloud","followers_url":"https://api.github.com/users/greenqloud/followers","following_url":"https://api.github.com/users/greenqloud/following{/other_user}","gists_url":"https://api.github.com/users/greenqloud/gists{/gist_id}","starred_url":"https://api.github.com/users/greenqloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenqloud/subscriptions","organizations_url":"https://api.github.com/users/greenqloud/orgs","repos_url":"https://api.github.com/users/greenqloud/repos","events_url":"https://api.github.com/users/greenqloud/events{/privacy}","received_events_url":"https://api.github.com/users/greenqloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/greenqloud/cloudstack","description":"Mirror of Apache Cloudstack","fork":true,"url":"https://api.github.com/repos/greenqloud/cloudstack","forks_url":"https://api.github.com/repos/greenqloud/cloudstack/forks","keys_url":"https://api.github.com/repos/greenqloud/cloudstack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greenqloud/cloudstack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greenqloud/cloudstack/teams","hooks_url":"https://api.github.com/repos/greenqloud/cloudstack/hooks","issue_events_url":"https://api.github.com/repos/greenqloud/cloudstack/issues/events{/number}","events_url":"https://api.github.com/repos/greenqloud/cloudstack/events","assignees_url":"https://api.github.com/repos/greenqloud/cloudstack/assignees{/user}","branches_url":"https://api.github.com/repos/greenqloud/cloudstack/branches{/branch}","tags_url":"https://api.github.com/repos/greenqloud/cloudstack/tags","blobs_url":"https://api.github.com/repos/greenqloud/cloudstack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greenqloud/cloudstack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greenqloud/cloudstack/git/refs{/sha}","trees_url":"https://api.github.com/repos/greenqloud/cloudstack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greenqloud/cloudstack/statuses/{sha}","languages_url":"https://api.github.com/repos/greenqloud/cloudstack/languages","stargazers_url":"https://api.github.com/repos/greenqloud/cloudstack/stargazers","contributors_url":"https://api.github.com/repos/greenqloud/cloudstack/contributors","subscribers_url":"https://api.github.com/repos/greenqloud/cloudstack/subscribers","subscription_url":"https://api.github.com/repos/greenqloud/cloudstack/subscription","commits_url":"https://api.github.com/repos/greenqloud/cloudstack/commits{/sha}","git_commits_url":"https://api.github.com/repos/greenqloud/cloudstack/git/commits{/sha}","comments_url":"https://api.github.com/repos/greenqloud/cloudstack/comments{/number}","issue_comment_url":"https://api.github.com/repos/greenqloud/cloudstack/issues/comments{/number}","contents_url":"https://api.github.com/repos/greenqloud/cloudstack/contents/{+path}","compare_url":"https://api.github.com/repos/greenqloud/cloudstack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greenqloud/cloudstack/merges","archive_url":"https://api.github.com/repos/greenqloud/cloudstack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greenqloud/cloudstack/downloads","issues_url":"https://api.github.com/repos/greenqloud/cloudstack/issues{/number}","pulls_url":"https://api.github.com/repos/greenqloud/cloudstack/pulls{/number}","milestones_url":"https://api.github.com/repos/greenqloud/cloudstack/milestones{/number}","notifications_url":"https://api.github.com/repos/greenqloud/cloudstack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greenqloud/cloudstack/labels{/name}","releases_url":"https://api.github.com/repos/greenqloud/cloudstack/releases{/id}","deployments_url":"https://api.github.com/repos/greenqloud/cloudstack/deployments","created_at":"2015-06-03T16:58:20Z","updated_at":"2016-08-19T14:55:26Z","pushed_at":"2016-10-03T14:26:44Z","git_url":"git://github.com/greenqloud/cloudstack.git","ssh_url":"git@github.com:greenqloud/cloudstack.git","clone_url":"https://github.com/greenqloud/cloudstack.git","svn_url":"https://github.com/greenqloud/cloudstack","homepage":null,"size":510953,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":1,"default_branch":"master"}},"base":{"label":"greenqloud:development","ref":"development","sha":"e8780529b2de895ec1592760a0dc3c38ebed7101","user":{"login":"greenqloud","id":228758,"avatar_url":"https://avatars.githubusercontent.com/u/228758?v=3","gravatar_id":"","url":"https://api.github.com/users/greenqloud","html_url":"https://github.com/greenqloud","followers_url":"https://api.github.com/users/greenqloud/followers","following_url":"https://api.github.com/users/greenqloud/following{/other_user}","gists_url":"https://api.github.com/users/greenqloud/gists{/gist_id}","starred_url":"https://api.github.com/users/greenqloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenqloud/subscriptions","organizations_url":"https://api.github.com/users/greenqloud/orgs","repos_url":"https://api.github.com/users/greenqloud/repos","events_url":"https://api.github.com/users/greenqloud/events{/privacy}","received_events_url":"https://api.github.com/users/greenqloud/received_events","type":"Organization","site_admin":false},"repo":{"id":36817746,"name":"cloudstack","full_name":"greenqloud/cloudstack","owner":{"login":"greenqloud","id":228758,"avatar_url":"https://avatars.githubusercontent.com/u/228758?v=3","gravatar_id":"","url":"https://api.github.com/users/greenqloud","html_url":"https://github.com/greenqloud","followers_url":"https://api.github.com/users/greenqloud/followers","following_url":"https://api.github.com/users/greenqloud/following{/other_user}","gists_url":"https://api.github.com/users/greenqloud/gists{/gist_id}","starred_url":"https://api.github.com/users/greenqloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenqloud/subscriptions","organizations_url":"https://api.github.com/users/greenqloud/orgs","repos_url":"https://api.github.com/users/greenqloud/repos","events_url":"https://api.github.com/users/greenqloud/events{/privacy}","received_events_url":"https://api.github.com/users/greenqloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/greenqloud/cloudstack","description":"Mirror of Apache Cloudstack","fork":true,"url":"https://api.github.com/repos/greenqloud/cloudstack","forks_url":"https://api.github.com/repos/greenqloud/cloudstack/forks","keys_url":"https://api.github.com/repos/greenqloud/cloudstack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greenqloud/cloudstack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greenqloud/cloudstack/teams","hooks_url":"https://api.github.com/repos/greenqloud/cloudstack/hooks","issue_events_url":"https://api.github.com/repos/greenqloud/cloudstack/issues/events{/number}","events_url":"https://api.github.com/repos/greenqloud/cloudstack/events","assignees_url":"https://api.github.com/repos/greenqloud/cloudstack/assignees{/user}","branches_url":"https://api.github.com/repos/greenqloud/cloudstack/branches{/branch}","tags_url":"https://api.github.com/repos/greenqloud/cloudstack/tags","blobs_url":"https://api.github.com/repos/greenqloud/cloudstack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greenqloud/cloudstack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greenqloud/cloudstack/git/refs{/sha}","trees_url":"https://api.github.com/repos/greenqloud/cloudstack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greenqloud/cloudstack/statuses/{sha}","languages_url":"https://api.github.com/repos/greenqloud/cloudstack/languages","stargazers_url":"https://api.github.com/repos/greenqloud/cloudstack/stargazers","contributors_url":"https://api.github.com/repos/greenqloud/cloudstack/contributors","subscribers_url":"https://api.github.com/repos/greenqloud/cloudstack/subscribers","subscription_url":"https://api.github.com/repos/greenqloud/cloudstack/subscription","commits_url":"https://api.github.com/repos/greenqloud/cloudstack/commits{/sha}","git_commits_url":"https://api.github.com/repos/greenqloud/cloudstack/git/commits{/sha}","comments_url":"https://api.github.com/repos/greenqloud/cloudstack/comments{/number}","issue_comment_url":"https://api.github.com/repos/greenqloud/cloudstack/issues/comments{/number}","contents_url":"https://api.github.com/repos/greenqloud/cloudstack/contents/{+path}","compare_url":"https://api.github.com/repos/greenqloud/cloudstack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greenqloud/cloudstack/merges","archive_url":"https://api.github.com/repos/greenqloud/cloudstack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greenqloud/cloudstack/downloads","issues_url":"https://api.github.com/repos/greenqloud/cloudstack/issues{/number}","pulls_url":"https://api.github.com/repos/greenqloud/cloudstack/pulls{/number}","milestones_url":"https://api.github.com/repos/greenqloud/cloudstack/milestones{/number}","notifications_url":"https://api.github.com/repos/greenqloud/cloudstack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greenqloud/cloudstack/labels{/name}","releases_url":"https://api.github.com/repos/greenqloud/cloudstack/releases{/id}","deployments_url":"https://api.github.com/repos/greenqloud/cloudstack/deployments","created_at":"2015-06-03T16:58:20Z","updated_at":"2016-08-19T14:55:26Z","pushed_at":"2016-10-03T14:26:44Z","git_url":"git://github.com/greenqloud/cloudstack.git","ssh_url":"git@github.com:greenqloud/cloudstack.git","clone_url":"https://github.com/greenqloud/cloudstack.git","svn_url":"https://github.com/greenqloud/cloudstack","homepage":null,"size":510953,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/greenqloud/cloudstack/pulls/124"},"html":{"href":"https://github.com/greenqloud/cloudstack/pull/124"},"issue":{"href":"https://api.github.com/repos/greenqloud/cloudstack/issues/124"},"comments":{"href":"https://api.github.com/repos/greenqloud/cloudstack/issues/124/comments"},"review_comments":{"href":"https://api.github.com/repos/greenqloud/cloudstack/pulls/124/comments"},"review_comment":{"href":"https://api.github.com/repos/greenqloud/cloudstack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/greenqloud/cloudstack/pulls/124/commits"},"statuses":{"href":"https://api.github.com/repos/greenqloud/cloudstack/statuses/415a946a90e2a8715e2f028d8dc429551953746a"}}}}
{"actor":{"display_login":"HrWiggles"}}