{"action":"created","comment":{"url":"https://api.github.com/repos/ceph/ceph/pulls/comments/26176597","id":26176597,"diff_hunk":"@@ -988,31 +988,20 @@ def get_free_partition_index(dev):\n \n     if not lines:\n         raise Error('parted failed to output anything')\n-    lines = str(lines).splitlines(True)\n-\n-    # work around buggy libreadline(?) library in rhel/centos.\n-    idiot_prefix = '\\x1b\\x5b\\x3f\\x31\\x30\\x33\\x34\\x68'\n-    if lines[0].startswith(idiot_prefix):\n-        lines[0] = lines[0][8:]\n-\n-    if lines[0] not in ['CHS;\\n', 'CYL;\\n', 'BYT;\\n']:\n-        raise Error('weird parted units', lines[0])\n-    del lines[0]\n-\n-    if not lines[0].startswith('/dev/'):\n-        raise Error('weird parted disk entry', lines[0])\n-    del lines[0]\n-\n-    seen = set()\n-    for line in lines:\n-        idx, _ = line.split(':', 1)\n-        idx = int(idx)\n-        seen.add(idx)\n-\n-    num = 1\n-    while num in seen:\n-        num += 1\n-    return num\n+    if ('CHS;' not in lines and\n+        'CYL;' not in lines and\n+        'BYT;' not in lines):\n+        raise Error('parted output expected to contain one of ' +\n+                    'CHH; CYL; or BYT; : ' + lines)\n+    if dev not in lines:","path":"src/ceph-disk","position":34,"original_position":34,"commit_id":"4b078126e9a21a608b83097668386121fea136bf","original_commit_id":"4b078126e9a21a608b83097668386121fea136bf","user":{"login":"dachary","id":433594,"avatar_url":"https://avatars.githubusercontent.com/u/433594?v=3","gravatar_id":"","url":"https://api.github.com/users/dachary","html_url":"https://github.com/dachary","followers_url":"https://api.github.com/users/dachary/followers","following_url":"https://api.github.com/users/dachary/following{/other_user}","gists_url":"https://api.github.com/users/dachary/gists{/gist_id}","starred_url":"https://api.github.com/users/dachary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dachary/subscriptions","organizations_url":"https://api.github.com/users/dachary/orgs","repos_url":"https://api.github.com/users/dachary/repos","events_url":"https://api.github.com/users/dachary/events{/privacy}","received_events_url":"https://api.github.com/users/dachary/received_events","type":"User","site_admin":false},"body":"the previous code assumes the format of parted is rigid and does not vary accross implementations. It turns out to not be the case. We could either task ourselves with the impossible mission of matching rigidly the format of all parted implementation. Or chose to implement a few sanity checks that gives us a reasonable certainty that the output is indeed something that looks like what parted would output.","created_at":"2015-03-10T23:22:51Z","updated_at":"2015-03-10T23:22:51Z","html_url":"https://github.com/ceph/ceph/pull/3872#discussion_r26176597","pull_request_url":"https://api.github.com/repos/ceph/ceph/pulls/3872","_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments/26176597"},"html":{"href":"https://github.com/ceph/ceph/pull/3872#discussion_r26176597"},"pull_request":{"href":"https://api.github.com/repos/ceph/ceph/pulls/3872"}}},"pull_request":{"url":"https://api.github.com/repos/ceph/ceph/pulls/3872","id":30471583,"html_url":"https://github.com/ceph/ceph/pull/3872","diff_url":"https://github.com/ceph/ceph/pull/3872.diff","patch_url":"https://github.com/ceph/ceph/pull/3872.patch","issue_url":"https://api.github.com/repos/ceph/ceph/issues/3872","number":3872,"state":"open","locked":false,"title":"ceph-disk: test activate on the second journal","user":{"login":"dachary","id":433594,"avatar_url":"https://avatars.githubusercontent.com/u/433594?v=3","gravatar_id":"","url":"https://api.github.com/users/dachary","html_url":"https://github.com/dachary","followers_url":"https://api.github.com/users/dachary/followers","following_url":"https://api.github.com/users/dachary/following{/other_user}","gists_url":"https://api.github.com/users/dachary/gists{/gist_id}","starred_url":"https://api.github.com/users/dachary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dachary/subscriptions","organizations_url":"https://api.github.com/users/dachary/orgs","repos_url":"https://api.github.com/users/dachary/repos","events_url":"https://api.github.com/users/dachary/events{/privacy}","received_events_url":"https://api.github.com/users/dachary/received_events","type":"User","site_admin":false},"body":"This series has been manually tested on Ubuntu 14.04, CentOS 7, RHEL 7, CentOS 6.5 and RHEL 6.5 on virtual machines and a native distribution installed, with a compilation from sources and the following command:\r\n<pre>\r\nsudo env PATH=:$PATH test/ceph-disk.sh test_activate_dev\r\n</pre>\r\nrun from the src directory. In the case of CentOS 6.5 and RHEL 6.5 an additional reboot was necessary to add loop.max_part=16 to the kernel cmdline.","created_at":"2015-03-04T14:54:50Z","updated_at":"2015-03-10T23:22:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6ba7537f66286b4c8e878ea6b7338c0fd2d4e607","assignee":{"login":"alfredodeza","id":317847,"avatar_url":"https://avatars.githubusercontent.com/u/317847?v=3","gravatar_id":"","url":"https://api.github.com/users/alfredodeza","html_url":"https://github.com/alfredodeza","followers_url":"https://api.github.com/users/alfredodeza/followers","following_url":"https://api.github.com/users/alfredodeza/following{/other_user}","gists_url":"https://api.github.com/users/alfredodeza/gists{/gist_id}","starred_url":"https://api.github.com/users/alfredodeza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alfredodeza/subscriptions","organizations_url":"https://api.github.com/users/alfredodeza/orgs","repos_url":"https://api.github.com/users/alfredodeza/repos","events_url":"https://api.github.com/users/alfredodeza/events{/privacy}","received_events_url":"https://api.github.com/users/alfredodeza/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ceph/ceph/pulls/3872/commits","review_comments_url":"https://api.github.com/repos/ceph/ceph/pulls/3872/comments","review_comment_url":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ceph/ceph/issues/3872/comments","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/4b078126e9a21a608b83097668386121fea136bf","head":{"label":"dachary:wip-7334-partx-test","ref":"wip-7334-partx-test","sha":"4b078126e9a21a608b83097668386121fea136bf","user":{"login":"dachary","id":433594,"avatar_url":"https://avatars.githubusercontent.com/u/433594?v=3","gravatar_id":"","url":"https://api.github.com/users/dachary","html_url":"https://github.com/dachary","followers_url":"https://api.github.com/users/dachary/followers","following_url":"https://api.github.com/users/dachary/following{/other_user}","gists_url":"https://api.github.com/users/dachary/gists{/gist_id}","starred_url":"https://api.github.com/users/dachary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dachary/subscriptions","organizations_url":"https://api.github.com/users/dachary/orgs","repos_url":"https://api.github.com/users/dachary/repos","events_url":"https://api.github.com/users/dachary/events{/privacy}","received_events_url":"https://api.github.com/users/dachary/received_events","type":"User","site_admin":false},"repo":{"id":7473403,"name":"ceph","full_name":"dachary/ceph","owner":{"login":"dachary","id":433594,"avatar_url":"https://avatars.githubusercontent.com/u/433594?v=3","gravatar_id":"","url":"https://api.github.com/users/dachary","html_url":"https://github.com/dachary","followers_url":"https://api.github.com/users/dachary/followers","following_url":"https://api.github.com/users/dachary/following{/other_user}","gists_url":"https://api.github.com/users/dachary/gists{/gist_id}","starred_url":"https://api.github.com/users/dachary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dachary/subscriptions","organizations_url":"https://api.github.com/users/dachary/orgs","repos_url":"https://api.github.com/users/dachary/repos","events_url":"https://api.github.com/users/dachary/events{/privacy}","received_events_url":"https://api.github.com/users/dachary/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dachary/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":true,"url":"https://api.github.com/repos/dachary/ceph","forks_url":"https://api.github.com/repos/dachary/ceph/forks","keys_url":"https://api.github.com/repos/dachary/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dachary/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dachary/ceph/teams","hooks_url":"https://api.github.com/repos/dachary/ceph/hooks","issue_events_url":"https://api.github.com/repos/dachary/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/dachary/ceph/events","assignees_url":"https://api.github.com/repos/dachary/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/dachary/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/dachary/ceph/tags","blobs_url":"https://api.github.com/repos/dachary/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dachary/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dachary/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/dachary/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dachary/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/dachary/ceph/languages","stargazers_url":"https://api.github.com/repos/dachary/ceph/stargazers","contributors_url":"https://api.github.com/repos/dachary/ceph/contributors","subscribers_url":"https://api.github.com/repos/dachary/ceph/subscribers","subscription_url":"https://api.github.com/repos/dachary/ceph/subscription","commits_url":"https://api.github.com/repos/dachary/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/dachary/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/dachary/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/dachary/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/dachary/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/dachary/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dachary/ceph/merges","archive_url":"https://api.github.com/repos/dachary/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dachary/ceph/downloads","issues_url":"https://api.github.com/repos/dachary/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/dachary/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/dachary/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/dachary/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dachary/ceph/labels{/name}","releases_url":"https://api.github.com/repos/dachary/ceph/releases{/id}","created_at":"2013-01-06T22:15:45Z","updated_at":"2015-02-02T10:25:53Z","pushed_at":"2015-03-10T22:55:30Z","git_url":"git://github.com/dachary/ceph.git","ssh_url":"git@github.com:dachary/ceph.git","clone_url":"https://github.com/dachary/ceph.git","svn_url":"https://github.com/dachary/ceph","homepage":"http://ceph.com","size":109325,"stargazers_count":4,"watchers_count":4,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":4,"default_branch":"master"}},"base":{"label":"ceph:master","ref":"master","sha":"51f5feccac085f693446a471309ed6600eaae8b0","user":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"repo":{"id":2310495,"name":"ceph","full_name":"ceph/ceph","owner":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ceph/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":false,"url":"https://api.github.com/repos/ceph/ceph","forks_url":"https://api.github.com/repos/ceph/ceph/forks","keys_url":"https://api.github.com/repos/ceph/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ceph/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ceph/ceph/teams","hooks_url":"https://api.github.com/repos/ceph/ceph/hooks","issue_events_url":"https://api.github.com/repos/ceph/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/ceph/ceph/events","assignees_url":"https://api.github.com/repos/ceph/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/ceph/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/ceph/ceph/tags","blobs_url":"https://api.github.com/repos/ceph/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ceph/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ceph/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/ceph/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/ceph/ceph/languages","stargazers_url":"https://api.github.com/repos/ceph/ceph/stargazers","contributors_url":"https://api.github.com/repos/ceph/ceph/contributors","subscribers_url":"https://api.github.com/repos/ceph/ceph/subscribers","subscription_url":"https://api.github.com/repos/ceph/ceph/subscription","commits_url":"https://api.github.com/repos/ceph/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/ceph/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/ceph/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/ceph/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/ceph/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/ceph/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ceph/ceph/merges","archive_url":"https://api.github.com/repos/ceph/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ceph/ceph/downloads","issues_url":"https://api.github.com/repos/ceph/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/ceph/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/ceph/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/ceph/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ceph/ceph/labels{/name}","releases_url":"https://api.github.com/repos/ceph/ceph/releases{/id}","created_at":"2011-09-01T21:41:26Z","updated_at":"2015-03-10T21:31:34Z","pushed_at":"2015-03-10T22:45:05Z","git_url":"git://github.com/ceph/ceph.git","ssh_url":"git@github.com:ceph/ceph.git","clone_url":"https://github.com/ceph/ceph.git","svn_url":"https://github.com/ceph/ceph","homepage":"http://ceph.com","size":374944,"stargazers_count":1169,"watchers_count":1169,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":609,"mirror_url":null,"open_issues_count":104,"forks":609,"open_issues":104,"watchers":1169,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/3872"},"html":{"href":"https://github.com/ceph/ceph/pull/3872"},"issue":{"href":"https://api.github.com/repos/ceph/ceph/issues/3872"},"comments":{"href":"https://api.github.com/repos/ceph/ceph/issues/3872/comments"},"review_comments":{"href":"https://api.github.com/repos/ceph/ceph/pulls/3872/comments"},"review_comment":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ceph/ceph/pulls/3872/commits"},"statuses":{"href":"https://api.github.com/repos/ceph/ceph/statuses/4b078126e9a21a608b83097668386121fea136bf"}}}}