{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/rkt/pulls/comments/40894560","id":40894560,"diff_hunk":"@@ -0,0 +1,126 @@\n+// Copyright 2015 The rkt Authors\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package stage0\n+\n+import (\n+\t\"fmt\"\n+\t\"io\"\n+\t\"os\"\n+\t\"os/exec\"\n+\t\"path/filepath\"\n+)\n+\n+const (\n+\tkvmSettingsDir        = \"/kvm\"\n+\tkvmPrivateKeyFilename = \"/ssh_kvm_key\"\n+)\n+\n+// fileAccessible checks if the given path exists and is a regular file\n+func fileAccessible(path string) bool {\n+\tinfo, err := os.Stat(path)\n+\tif err == nil {\n+\t\treturn info.Mode().IsRegular()\n+\t}\n+\treturn false\n+}\n+\n+func sshPrivateKeyPath(dataDir string) string {\n+\treturn filepath.Join(dataDir, kvmSettingsDir, kvmPrivateKeyFilename)\n+}\n+\n+func sshPublicKeyPath(dataDir string) string {\n+\treturn filepath.Join(dataDir, kvmSettingsDir, kvmPrivateKeyFilename+\".pub\")\n+}\n+\n+func createKvmSettingsDir(dataDir string) error {\n+\treturn os.MkdirAll(filepath.Join(dataDir, kvmSettingsDir), 0700)\n+}\n+\n+// generateKeyPair calls ssh-keygen with private key location for key generation purpose\n+func generateKeyPair(private string) error {\n+\tout, err := exec.Command(\n+\t\t\"ssh-keygen\",\n+\t\t\"-q\",        // silence\n+\t\t\"-t\", \"dsa\", // type\n+\t\t\"-b\", \"1024\", // length in bits\n+\t\t\"-f\", private, // output file\n+\t\t\"-N\", \"\", // no passphrase\n+\t).Output()\n+\tif err != nil {\n+\t\treturn fmt.Errorf(\"error in keygen time. ret_val: %v, output: %v\", err, string(out[:len(out)]))","path":"stage0/kvm.go","position":62,"original_position":62,"commit_id":"2b1a2df65fe964ee3a5e3c4866e018722c64df36","original_commit_id":"2b1a2df65fe964ee3a5e3c4866e018722c64df36","user":{"login":"jellonek","id":658436,"avatar_url":"https://avatars.githubusercontent.com/u/658436?v=3","gravatar_id":"","url":"https://api.github.com/users/jellonek","html_url":"https://github.com/jellonek","followers_url":"https://api.github.com/users/jellonek/followers","following_url":"https://api.github.com/users/jellonek/following{/other_user}","gists_url":"https://api.github.com/users/jellonek/gists{/gist_id}","starred_url":"https://api.github.com/users/jellonek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jellonek/subscriptions","organizations_url":"https://api.github.com/users/jellonek/orgs","repos_url":"https://api.github.com/users/jellonek/repos","events_url":"https://api.github.com/users/jellonek/events{/privacy}","received_events_url":"https://api.github.com/users/jellonek/received_events","type":"User","site_admin":false},"body":"Try it ;)\r\nNo, it isn't. It would not trim ending multiple \\0","created_at":"2015-10-01T09:29:53Z","updated_at":"2015-10-01T09:29:53Z","html_url":"https://github.com/coreos/rkt/pull/1303#discussion_r40894560","pull_request_url":"https://api.github.com/repos/coreos/rkt/pulls/1303","_links":{"self":{"href":"https://api.github.com/repos/coreos/rkt/pulls/comments/40894560"},"html":{"href":"https://github.com/coreos/rkt/pull/1303#discussion_r40894560"},"pull_request":{"href":"https://api.github.com/repos/coreos/rkt/pulls/1303"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/rkt/pulls/1303","id":42822373,"html_url":"https://github.com/coreos/rkt/pull/1303","diff_url":"https://github.com/coreos/rkt/pull/1303.diff","patch_url":"https://github.com/coreos/rkt/pull/1303.patch","issue_url":"https://api.github.com/repos/coreos/rkt/issues/1303","number":1303,"state":"open","locked":false,"title":"[kvm] Entering into pod","user":{"login":"jellonek","id":658436,"avatar_url":"https://avatars.githubusercontent.com/u/658436?v=3","gravatar_id":"","url":"https://api.github.com/users/jellonek","html_url":"https://github.com/jellonek","followers_url":"https://api.github.com/users/jellonek/followers","following_url":"https://api.github.com/users/jellonek/following{/other_user}","gists_url":"https://api.github.com/users/jellonek/gists{/gist_id}","starred_url":"https://api.github.com/users/jellonek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jellonek/subscriptions","organizations_url":"https://api.github.com/users/jellonek/orgs","repos_url":"https://api.github.com/users/jellonek/repos","events_url":"https://api.github.com/users/jellonek/events{/privacy}","received_events_url":"https://api.github.com/users/jellonek/received_events","type":"User","site_admin":false},"body":"First step on route to implement entering into POD mounted as lkvm VM.\r\n\r\nRFC. Especially @krnowak ","created_at":"2015-08-19T14:40:57Z","updated_at":"2015-10-01T09:29:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3758045e2e7a122b74e3433bd9e648007c9ca4b8","assignee":null,"milestone":{"url":"https://api.github.com/repos/coreos/rkt/milestones/19","html_url":"https://github.com/coreos/rkt/milestones/v0.9.0","labels_url":"https://api.github.com/repos/coreos/rkt/milestones/19/labels","id":1209255,"number":19,"title":"v0.9.0","description":"","creator":{"login":"alban","id":27575,"avatar_url":"https://avatars.githubusercontent.com/u/27575?v=3","gravatar_id":"","url":"https://api.github.com/users/alban","html_url":"https://github.com/alban","followers_url":"https://api.github.com/users/alban/followers","following_url":"https://api.github.com/users/alban/following{/other_user}","gists_url":"https://api.github.com/users/alban/gists{/gist_id}","starred_url":"https://api.github.com/users/alban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alban/subscriptions","organizations_url":"https://api.github.com/users/alban/orgs","repos_url":"https://api.github.com/users/alban/repos","events_url":"https://api.github.com/users/alban/events{/privacy}","received_events_url":"https://api.github.com/users/alban/received_events","type":"User","site_admin":false},"open_issues":27,"closed_issues":90,"state":"open","created_at":"2015-07-15T13:18:47Z","updated_at":"2015-10-01T07:24:56Z","due_on":"2015-09-30T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/coreos/rkt/pulls/1303/commits","review_comments_url":"https://api.github.com/repos/coreos/rkt/pulls/1303/comments","review_comment_url":"https://api.github.com/repos/coreos/rkt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/rkt/issues/1303/comments","statuses_url":"https://api.github.com/repos/coreos/rkt/statuses/2b1a2df65fe964ee3a5e3c4866e018722c64df36","head":{"label":"intelsdi-x:entering","ref":"entering","sha":"2b1a2df65fe964ee3a5e3c4866e018722c64df36","user":{"login":"intelsdi-x","id":8398747,"avatar_url":"https://avatars.githubusercontent.com/u/8398747?v=3","gravatar_id":"","url":"https://api.github.com/users/intelsdi-x","html_url":"https://github.com/intelsdi-x","followers_url":"https://api.github.com/users/intelsdi-x/followers","following_url":"https://api.github.com/users/intelsdi-x/following{/other_user}","gists_url":"https://api.github.com/users/intelsdi-x/gists{/gist_id}","starred_url":"https://api.github.com/users/intelsdi-x/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/intelsdi-x/subscriptions","organizations_url":"https://api.github.com/users/intelsdi-x/orgs","repos_url":"https://api.github.com/users/intelsdi-x/repos","events_url":"https://api.github.com/users/intelsdi-x/events{/privacy}","received_events_url":"https://api.github.com/users/intelsdi-x/received_events","type":"Organization","site_admin":false},"repo":{"id":38779722,"name":"rkt","full_name":"intelsdi-x/rkt","owner":{"login":"intelsdi-x","id":8398747,"avatar_url":"https://avatars.githubusercontent.com/u/8398747?v=3","gravatar_id":"","url":"https://api.github.com/users/intelsdi-x","html_url":"https://github.com/intelsdi-x","followers_url":"https://api.github.com/users/intelsdi-x/followers","following_url":"https://api.github.com/users/intelsdi-x/following{/other_user}","gists_url":"https://api.github.com/users/intelsdi-x/gists{/gist_id}","starred_url":"https://api.github.com/users/intelsdi-x/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/intelsdi-x/subscriptions","organizations_url":"https://api.github.com/users/intelsdi-x/orgs","repos_url":"https://api.github.com/users/intelsdi-x/repos","events_url":"https://api.github.com/users/intelsdi-x/events{/privacy}","received_events_url":"https://api.github.com/users/intelsdi-x/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/intelsdi-x/rkt","description":"rkt is an App Container runtime for Linux","fork":true,"url":"https://api.github.com/repos/intelsdi-x/rkt","forks_url":"https://api.github.com/repos/intelsdi-x/rkt/forks","keys_url":"https://api.github.com/repos/intelsdi-x/rkt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/intelsdi-x/rkt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/intelsdi-x/rkt/teams","hooks_url":"https://api.github.com/repos/intelsdi-x/rkt/hooks","issue_events_url":"https://api.github.com/repos/intelsdi-x/rkt/issues/events{/number}","events_url":"https://api.github.com/repos/intelsdi-x/rkt/events","assignees_url":"https://api.github.com/repos/intelsdi-x/rkt/assignees{/user}","branches_url":"https://api.github.com/repos/intelsdi-x/rkt/branches{/branch}","tags_url":"https://api.github.com/repos/intelsdi-x/rkt/tags","blobs_url":"https://api.github.com/repos/intelsdi-x/rkt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/intelsdi-x/rkt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/intelsdi-x/rkt/git/refs{/sha}","trees_url":"https://api.github.com/repos/intelsdi-x/rkt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/intelsdi-x/rkt/statuses/{sha}","languages_url":"https://api.github.com/repos/intelsdi-x/rkt/languages","stargazers_url":"https://api.github.com/repos/intelsdi-x/rkt/stargazers","contributors_url":"https://api.github.com/repos/intelsdi-x/rkt/contributors","subscribers_url":"https://api.github.com/repos/intelsdi-x/rkt/subscribers","subscription_url":"https://api.github.com/repos/intelsdi-x/rkt/subscription","commits_url":"https://api.github.com/repos/intelsdi-x/rkt/commits{/sha}","git_commits_url":"https://api.github.com/repos/intelsdi-x/rkt/git/commits{/sha}","comments_url":"https://api.github.com/repos/intelsdi-x/rkt/comments{/number}","issue_comment_url":"https://api.github.com/repos/intelsdi-x/rkt/issues/comments{/number}","contents_url":"https://api.github.com/repos/intelsdi-x/rkt/contents/{+path}","compare_url":"https://api.github.com/repos/intelsdi-x/rkt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/intelsdi-x/rkt/merges","archive_url":"https://api.github.com/repos/intelsdi-x/rkt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/intelsdi-x/rkt/downloads","issues_url":"https://api.github.com/repos/intelsdi-x/rkt/issues{/number}","pulls_url":"https://api.github.com/repos/intelsdi-x/rkt/pulls{/number}","milestones_url":"https://api.github.com/repos/intelsdi-x/rkt/milestones{/number}","notifications_url":"https://api.github.com/repos/intelsdi-x/rkt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/intelsdi-x/rkt/labels{/name}","releases_url":"https://api.github.com/repos/intelsdi-x/rkt/releases{/id}","created_at":"2015-07-08T21:00:32Z","updated_at":"2015-08-05T19:42:28Z","pushed_at":"2015-09-30T13:54:38Z","git_url":"git://github.com/intelsdi-x/rkt.git","ssh_url":"git@github.com:intelsdi-x/rkt.git","clone_url":"https://github.com/intelsdi-x/rkt.git","svn_url":"https://github.com/intelsdi-x/rkt","homepage":"","size":16919,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":8,"forks":0,"open_issues":8,"watchers":0,"default_branch":"master"}},"base":{"label":"coreos:master","ref":"master","sha":"8347cd232572fae9e6fd8d2af385e22afc8effb5","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":26509369,"name":"rkt","full_name":"coreos/rkt","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/rkt","description":"rkt is an App Container runtime for Linux","fork":false,"url":"https://api.github.com/repos/coreos/rkt","forks_url":"https://api.github.com/repos/coreos/rkt/forks","keys_url":"https://api.github.com/repos/coreos/rkt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/rkt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/rkt/teams","hooks_url":"https://api.github.com/repos/coreos/rkt/hooks","issue_events_url":"https://api.github.com/repos/coreos/rkt/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/rkt/events","assignees_url":"https://api.github.com/repos/coreos/rkt/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/rkt/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/rkt/tags","blobs_url":"https://api.github.com/repos/coreos/rkt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/rkt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/rkt/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/rkt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/rkt/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/rkt/languages","stargazers_url":"https://api.github.com/repos/coreos/rkt/stargazers","contributors_url":"https://api.github.com/repos/coreos/rkt/contributors","subscribers_url":"https://api.github.com/repos/coreos/rkt/subscribers","subscription_url":"https://api.github.com/repos/coreos/rkt/subscription","commits_url":"https://api.github.com/repos/coreos/rkt/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/rkt/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/rkt/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/rkt/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/rkt/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/rkt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/rkt/merges","archive_url":"https://api.github.com/repos/coreos/rkt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/rkt/downloads","issues_url":"https://api.github.com/repos/coreos/rkt/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/rkt/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/rkt/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/rkt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/rkt/labels{/name}","releases_url":"https://api.github.com/repos/coreos/rkt/releases{/id}","created_at":"2014-11-11T23:13:18Z","updated_at":"2015-09-30T21:24:57Z","pushed_at":"2015-10-01T07:24:16Z","git_url":"git://github.com/coreos/rkt.git","ssh_url":"git@github.com:coreos/rkt.git","clone_url":"https://github.com/coreos/rkt.git","svn_url":"https://github.com/coreos/rkt","homepage":"","size":26760,"stargazers_count":4704,"watchers_count":4704,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":388,"mirror_url":null,"open_issues_count":171,"forks":388,"open_issues":171,"watchers":4704,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/rkt/pulls/1303"},"html":{"href":"https://github.com/coreos/rkt/pull/1303"},"issue":{"href":"https://api.github.com/repos/coreos/rkt/issues/1303"},"comments":{"href":"https://api.github.com/repos/coreos/rkt/issues/1303/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/rkt/pulls/1303/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/rkt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/rkt/pulls/1303/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/rkt/statuses/2b1a2df65fe964ee3a5e3c4866e018722c64df36"}}}}