{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/rkt/pulls/comments/62406434","id":62406434,"diff_hunk":"@@ -0,0 +1,225 @@\n+// Copyright 2016 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 main\n+\n+import (\n+\t\"archive/tar\"\n+\t\"compress/gzip\"\n+\t\"errors\"\n+\t\"fmt\"\n+\t\"io/ioutil\"\n+\t\"os\"\n+\t\"path\"\n+\t\"path/filepath\"\n+\t\"syscall\"\n+\n+\t\"github.com/appc/spec/aci\"\n+\t\"github.com/appc/spec/schema\"\n+\t\"github.com/coreos/rkt/common\"\n+\t\"github.com/coreos/rkt/common/overlay\"\n+\t\"github.com/coreos/rkt/pkg/user\"\n+\t\"github.com/coreos/rkt/store\"\n+\t\"github.com/hashicorp/errwrap\"\n+\t\"github.com/spf13/cobra\"\n+)\n+\n+var (\n+\tcmdExport = &cobra.Command{\n+\t\tUse:   \"export UUID OUTPUT_ACI_FILE\",\n+\t\tShort: \"Export an exited pod to an ACI file\",\n+\t\tLong: `UUID should be the uuid of an exited pod.\n+\n+Note that currently only pods with a single app are supported.`,\n+\t\tRun: runWrapper(runExport),\n+\t}\n+)\n+\n+func init() {\n+\tcmdRkt.AddCommand(cmdExport)\n+\tcmdExport.Flags().BoolVar(&flagOverwriteACI, \"overwrite\", false, \"overwrite output ACI\")\n+}\n+\n+func runExport(cmd *cobra.Command, args []string) (exit int) {\n+\tif len(args) != 2 {\n+\t\tcmd.Usage()\n+\t\treturn 1\n+\t}\n+\n+\taci := args[1]\n+\text := filepath.Ext(aci)\n+\tif ext != schema.ACIExtension {\n+\t\tstderr.Printf(\"extension must be %s (given %s)\", schema.ACIExtension, aci)\n+\t\treturn 1\n+\t}\n+\n+\tp, err := getPodFromUUIDString(args[0])\n+\tif err != nil {\n+\t\tstderr.PrintE(\"problem retrieving pod\", err)\n+\t\treturn 1\n+\t}\n+\tdefer p.Close()\n+\n+\tif !p.isExited {\n+\t\tstderr.Print(\"pod is not exited. Only exited pods are supported.\")\n+\t\treturn 1\n+\t}\n+\n+\tapps, err := p.getApps()\n+\tif err != nil {\n+\t\tstderr.PrintE(\"problem getting the pod's app list\", err)\n+\t\treturn 1\n+\t}\n+\n+\tif len(apps) != 1 {\n+\t\tstderr.Printf(\"pod has %d app. Only pods with one app are supported\", len(apps))\n+\t\treturn 1\n+\t}\n+\tapp := apps[0]\n+\n+\tif p.usesOverlay() {\n+\t\ttmpMntDir := path.Join(getDataDir(), \"tmp\", fmt.Sprintf(\"rkt-export-%s\", p.uuid))\n+\t\tstdout.Println(tmpMntDir)","path":"rkt/export.go","position":93,"original_position":93,"commit_id":"77902a1312653c2366fc84077c186b51c2844587","original_commit_id":"77902a1312653c2366fc84077c186b51c2844587","user":{"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},"body":"debugging leftover","created_at":"2016-05-07T00:13:48Z","updated_at":"2016-05-07T00:13:48Z","html_url":"https://github.com/coreos/rkt/pull/2343#discussion_r62406434","pull_request_url":"https://api.github.com/repos/coreos/rkt/pulls/2343","_links":{"self":{"href":"https://api.github.com/repos/coreos/rkt/pulls/comments/62406434"},"html":{"href":"https://github.com/coreos/rkt/pull/2343#discussion_r62406434"},"pull_request":{"href":"https://api.github.com/repos/coreos/rkt/pulls/2343"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/rkt/pulls/2343","id":64620283,"html_url":"https://github.com/coreos/rkt/pull/2343","diff_url":"https://github.com/coreos/rkt/pull/2343.diff","patch_url":"https://github.com/coreos/rkt/pull/2343.patch","issue_url":"https://api.github.com/repos/coreos/rkt/issues/2343","number":2343,"state":"open","locked":false,"title":"rkt: add command to export a pod to an aci","user":{"login":"blixtra","id":115075,"avatar_url":"https://avatars.githubusercontent.com/u/115075?v=3","gravatar_id":"","url":"https://api.github.com/users/blixtra","html_url":"https://github.com/blixtra","followers_url":"https://api.github.com/users/blixtra/followers","following_url":"https://api.github.com/users/blixtra/following{/other_user}","gists_url":"https://api.github.com/users/blixtra/gists{/gist_id}","starred_url":"https://api.github.com/users/blixtra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blixtra/subscriptions","organizations_url":"https://api.github.com/users/blixtra/orgs","repos_url":"https://api.github.com/users/blixtra/repos","events_url":"https://api.github.com/users/blixtra/events{/privacy}","received_events_url":"https://api.github.com/users/blixtra/received_events","type":"User","site_admin":false},"body":"Adds a new `export` command to rkt which generates an aci from a\r\npod; saving any changes made to the pod.\r\n\r\nUsage is `rkt export POD_UUID my.aci`\r\n\r\nThis is currently restricted to only working with exited pods with a\r\nsingle app.\r\n\r\nFixes #1197","created_at":"2016-03-30T12:41:22Z","updated_at":"2016-05-07T00:13:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fca0830581633121029248e517fb83c8cce6b545","assignee":{"login":"blixtra","id":115075,"avatar_url":"https://avatars.githubusercontent.com/u/115075?v=3","gravatar_id":"","url":"https://api.github.com/users/blixtra","html_url":"https://github.com/blixtra","followers_url":"https://api.github.com/users/blixtra/followers","following_url":"https://api.github.com/users/blixtra/following{/other_user}","gists_url":"https://api.github.com/users/blixtra/gists{/gist_id}","starred_url":"https://api.github.com/users/blixtra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blixtra/subscriptions","organizations_url":"https://api.github.com/users/blixtra/orgs","repos_url":"https://api.github.com/users/blixtra/repos","events_url":"https://api.github.com/users/blixtra/events{/privacy}","received_events_url":"https://api.github.com/users/blixtra/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/coreos/rkt/milestones/37","html_url":"https://github.com/coreos/rkt/milestones/v1.6.0","labels_url":"https://api.github.com/repos/coreos/rkt/milestones/37/labels","id":1705895,"number":37,"title":"v1.6.0","description":"","creator":{"login":"iaguis","id":507354,"avatar_url":"https://avatars.githubusercontent.com/u/507354?v=3","gravatar_id":"","url":"https://api.github.com/users/iaguis","html_url":"https://github.com/iaguis","followers_url":"https://api.github.com/users/iaguis/followers","following_url":"https://api.github.com/users/iaguis/following{/other_user}","gists_url":"https://api.github.com/users/iaguis/gists{/gist_id}","starred_url":"https://api.github.com/users/iaguis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iaguis/subscriptions","organizations_url":"https://api.github.com/users/iaguis/orgs","repos_url":"https://api.github.com/users/iaguis/repos","events_url":"https://api.github.com/users/iaguis/events{/privacy}","received_events_url":"https://api.github.com/users/iaguis/received_events","type":"User","site_admin":false},"open_issues":83,"closed_issues":19,"state":"open","created_at":"2016-04-14T12:45:50Z","updated_at":"2016-05-06T23:48:51Z","due_on":"2016-05-11T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/coreos/rkt/pulls/2343/commits","review_comments_url":"https://api.github.com/repos/coreos/rkt/pulls/2343/comments","review_comment_url":"https://api.github.com/repos/coreos/rkt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/rkt/issues/2343/comments","statuses_url":"https://api.github.com/repos/coreos/rkt/statuses/77902a1312653c2366fc84077c186b51c2844587","head":{"label":"kinvolk:ckuehl/implement-pod-export","ref":"ckuehl/implement-pod-export","sha":"77902a1312653c2366fc84077c186b51c2844587","user":{"login":"kinvolk","id":14073052,"avatar_url":"https://avatars.githubusercontent.com/u/14073052?v=3","gravatar_id":"","url":"https://api.github.com/users/kinvolk","html_url":"https://github.com/kinvolk","followers_url":"https://api.github.com/users/kinvolk/followers","following_url":"https://api.github.com/users/kinvolk/following{/other_user}","gists_url":"https://api.github.com/users/kinvolk/gists{/gist_id}","starred_url":"https://api.github.com/users/kinvolk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinvolk/subscriptions","organizations_url":"https://api.github.com/users/kinvolk/orgs","repos_url":"https://api.github.com/users/kinvolk/repos","events_url":"https://api.github.com/users/kinvolk/events{/privacy}","received_events_url":"https://api.github.com/users/kinvolk/received_events","type":"Organization","site_admin":false},"repo":{"id":45149715,"name":"rkt","full_name":"kinvolk/rkt","owner":{"login":"kinvolk","id":14073052,"avatar_url":"https://avatars.githubusercontent.com/u/14073052?v=3","gravatar_id":"","url":"https://api.github.com/users/kinvolk","html_url":"https://github.com/kinvolk","followers_url":"https://api.github.com/users/kinvolk/followers","following_url":"https://api.github.com/users/kinvolk/following{/other_user}","gists_url":"https://api.github.com/users/kinvolk/gists{/gist_id}","starred_url":"https://api.github.com/users/kinvolk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinvolk/subscriptions","organizations_url":"https://api.github.com/users/kinvolk/orgs","repos_url":"https://api.github.com/users/kinvolk/repos","events_url":"https://api.github.com/users/kinvolk/events{/privacy}","received_events_url":"https://api.github.com/users/kinvolk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kinvolk/rkt","description":"rkt is an App Container runtime for Linux","fork":true,"url":"https://api.github.com/repos/kinvolk/rkt","forks_url":"https://api.github.com/repos/kinvolk/rkt/forks","keys_url":"https://api.github.com/repos/kinvolk/rkt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kinvolk/rkt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kinvolk/rkt/teams","hooks_url":"https://api.github.com/repos/kinvolk/rkt/hooks","issue_events_url":"https://api.github.com/repos/kinvolk/rkt/issues/events{/number}","events_url":"https://api.github.com/repos/kinvolk/rkt/events","assignees_url":"https://api.github.com/repos/kinvolk/rkt/assignees{/user}","branches_url":"https://api.github.com/repos/kinvolk/rkt/branches{/branch}","tags_url":"https://api.github.com/repos/kinvolk/rkt/tags","blobs_url":"https://api.github.com/repos/kinvolk/rkt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kinvolk/rkt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kinvolk/rkt/git/refs{/sha}","trees_url":"https://api.github.com/repos/kinvolk/rkt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kinvolk/rkt/statuses/{sha}","languages_url":"https://api.github.com/repos/kinvolk/rkt/languages","stargazers_url":"https://api.github.com/repos/kinvolk/rkt/stargazers","contributors_url":"https://api.github.com/repos/kinvolk/rkt/contributors","subscribers_url":"https://api.github.com/repos/kinvolk/rkt/subscribers","subscription_url":"https://api.github.com/repos/kinvolk/rkt/subscription","commits_url":"https://api.github.com/repos/kinvolk/rkt/commits{/sha}","git_commits_url":"https://api.github.com/repos/kinvolk/rkt/git/commits{/sha}","comments_url":"https://api.github.com/repos/kinvolk/rkt/comments{/number}","issue_comment_url":"https://api.github.com/repos/kinvolk/rkt/issues/comments{/number}","contents_url":"https://api.github.com/repos/kinvolk/rkt/contents/{+path}","compare_url":"https://api.github.com/repos/kinvolk/rkt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kinvolk/rkt/merges","archive_url":"https://api.github.com/repos/kinvolk/rkt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kinvolk/rkt/downloads","issues_url":"https://api.github.com/repos/kinvolk/rkt/issues{/number}","pulls_url":"https://api.github.com/repos/kinvolk/rkt/pulls{/number}","milestones_url":"https://api.github.com/repos/kinvolk/rkt/milestones{/number}","notifications_url":"https://api.github.com/repos/kinvolk/rkt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kinvolk/rkt/labels{/name}","releases_url":"https://api.github.com/repos/kinvolk/rkt/releases{/id}","deployments_url":"https://api.github.com/repos/kinvolk/rkt/deployments","created_at":"2015-10-29T00:17:06Z","updated_at":"2016-01-13T16:51:16Z","pushed_at":"2016-05-06T15:33:22Z","git_url":"git://github.com/kinvolk/rkt.git","ssh_url":"git@github.com:kinvolk/rkt.git","clone_url":"https://github.com/kinvolk/rkt.git","svn_url":"https://github.com/kinvolk/rkt","homepage":"","size":20804,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"coreos:master","ref":"master","sha":"d145cea1396ed951e2f6e773df6c13937ec57fc6","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}","deployments_url":"https://api.github.com/repos/coreos/rkt/deployments","created_at":"2014-11-11T23:13:18Z","updated_at":"2016-05-06T20:10:15Z","pushed_at":"2016-05-06T23:20:09Z","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":24435,"stargazers_count":5467,"watchers_count":5467,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":507,"mirror_url":null,"open_issues_count":333,"forks":507,"open_issues":333,"watchers":5467,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/rkt/pulls/2343"},"html":{"href":"https://github.com/coreos/rkt/pull/2343"},"issue":{"href":"https://api.github.com/repos/coreos/rkt/issues/2343"},"comments":{"href":"https://api.github.com/repos/coreos/rkt/issues/2343/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/rkt/pulls/2343/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/rkt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/rkt/pulls/2343/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/rkt/statuses/77902a1312653c2366fc84077c186b51c2844587"}}}}