{"action":"created","comment":{"url":"https://api.github.com/repos/lxc/lxd/pulls/comments/116936711","pull_request_review_id":38597681,"id":116936711,"diff_hunk":"@@ -0,0 +1,60 @@\n+test_init_preseed() {\n+  # - lxd init --preseed\n+  LXD_INIT_DIR=$(mktemp -d -p \"${TEST_DIR}\" XXX)\n+  chmod +x \"${LXD_INIT_DIR}\"\n+  spawn_lxd \"${LXD_INIT_DIR}\" false\n+  (\n+    set -e\n+    # shellcheck disable=SC2034\n+    LXD_DIR=${LXD_INIT_DIR}\n+\n+    cat <<EOF | lxd init --preseed\n+config:\n+  core.https_address: 127.0.0.1:9999\n+  images.auto_update_interval: 15\n+pools:","path":"test/suites/init_preseed.sh","position":30,"original_position":15,"commit_id":"1452a5af5fbb144e1b56a9051b647609a810fe92","original_commit_id":"a5a7ffd0dd780e35fbaa0e80bb726e7657cad6ab","user":{"login":"freeekanayaka","id":598445,"avatar_url":"https://avatars3.githubusercontent.com/u/598445?v=3","gravatar_id":"","url":"https://api.github.com/users/freeekanayaka","html_url":"https://github.com/freeekanayaka","followers_url":"https://api.github.com/users/freeekanayaka/followers","following_url":"https://api.github.com/users/freeekanayaka/following{/other_user}","gists_url":"https://api.github.com/users/freeekanayaka/gists{/gist_id}","starred_url":"https://api.github.com/users/freeekanayaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freeekanayaka/subscriptions","organizations_url":"https://api.github.com/users/freeekanayaka/orgs","repos_url":"https://api.github.com/users/freeekanayaka/repos","events_url":"https://api.github.com/users/freeekanayaka/events{/privacy}","received_events_url":"https://api.github.com/users/freeekanayaka/received_events","type":"User","site_admin":false},"body":"Done.\r\n\r\nHowever I think \"storage-pools\" might be a tad more appropriate than \"storage_pools\", since the format and keys of this YAML closely matches the RESTful API, and the endpoint for storage pools is called \"/storage-pools\" there, not \"storage_pools\".","created_at":"2017-05-17T08:17:35Z","updated_at":"2017-05-17T08:17:35Z","html_url":"https://github.com/lxc/lxd/pull/3276#discussion_r116936711","pull_request_url":"https://api.github.com/repos/lxc/lxd/pulls/3276","_links":{"self":{"href":"https://api.github.com/repos/lxc/lxd/pulls/comments/116936711"},"html":{"href":"https://github.com/lxc/lxd/pull/3276#discussion_r116936711"},"pull_request":{"href":"https://api.github.com/repos/lxc/lxd/pulls/3276"}}},"pull_request":{"url":"https://api.github.com/repos/lxc/lxd/pulls/3276","id":118699582,"html_url":"https://github.com/lxc/lxd/pull/3276","diff_url":"https://github.com/lxc/lxd/pull/3276.diff","patch_url":"https://github.com/lxc/lxd/pull/3276.patch","issue_url":"https://api.github.com/repos/lxc/lxd/issues/3276","number":3276,"state":"open","locked":false,"title":"Implement initial support for \"lxd init --preseed\"","user":{"login":"freeekanayaka","id":598445,"avatar_url":"https://avatars3.githubusercontent.com/u/598445?v=3","gravatar_id":"","url":"https://api.github.com/users/freeekanayaka","html_url":"https://github.com/freeekanayaka","followers_url":"https://api.github.com/users/freeekanayaka/followers","following_url":"https://api.github.com/users/freeekanayaka/following{/other_user}","gists_url":"https://api.github.com/users/freeekanayaka/gists{/gist_id}","starred_url":"https://api.github.com/users/freeekanayaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freeekanayaka/subscriptions","organizations_url":"https://api.github.com/users/freeekanayaka/orgs","repos_url":"https://api.github.com/users/freeekanayaka/repos","events_url":"https://api.github.com/users/freeekanayaka/events{/privacy}","received_events_url":"https://api.github.com/users/freeekanayaka/received_events","type":"User","site_admin":false},"body":"This is the first pass to implement #2834.\r\n\r\nIt consists of 4 commits that incrementally add support for preseeding the various entities we want.\r\n\r\nWhat it does:\r\n\r\nSupport running \"lxd init --preseed\" and feeding it with YAML via standard input to create storage pools, network devices, profiles and set server parameters. For example:\r\n\r\n```\r\n  # cat <<EOF | lxd init --preseed\r\nconfig:\r\n  core.https_address: 127.0.0.1:9999\r\n  images.auto_update_interval: 15\r\npools:\r\n- name: data\r\n  driver: dir\r\n  config:\r\n    source: \"\"\r\nnetworks:\r\n- name: lxd-my-bridge\r\n  type: bridge\r\n  config:\r\n    ipv4.address: none\r\n    ipv6.address: none\r\nprofiles:\r\n- name: default\r\n  devices:\r\n    root:\r\n      path: /\r\n      pool: data\r\n      type: disk\r\n- name: test-profile\r\n  description: \"Test profile\"\r\n  config:\r\n    limits.memory: 2GB\r\n  devices:\r\n    test0:\r\n      name: test0\r\n      nictype: bridged\r\n      parent: lxd-my-bridge\r\n      type: nic\r\nEOF\r\n```\r\nWhat it does not (yet) do:\r\n\r\n- Add more extensive documentation for the feature. I'd like to first get feedback that this implementation is fine (name of the command line switch, format of the YAML, etc) and then write the docs. I'm also not entirely sure where they should go (in a new preseed.md file under doc/ ?).\r\n\r\n- Support shortcuts to avoid having to explicitly attach storage pools or network devices to the default profile. This is possibility is mentioned in the issue, but it's hand-wavy for now, we should define how it works first, and it can be considered a follow-up improvement.\r\n\r\n- Support passing an argument name to the --preseed command line switch. If you pass \"-\" that would mean read the YAML from standard in (i.e. the same as you pass nothing), if you pass something other than \"-\" it will be interpreted as the path to a file to read, containing the YAML. This can be done as follow-up to.\r\n\r\n- Cleanup the logic in main_init.go a bit more, so the various auto/interactive/preseed code paths share more code, and easier to understand maintain and extend. I have a few commits for this that I'll submit in a separate PR when this one lands.","created_at":"2017-05-03T06:50:08Z","updated_at":"2017-05-17T08:17:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55aabc9c38467b60339fa4ccfc3c8051376e6473","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/lxc/lxd/pulls/3276/commits","review_comments_url":"https://api.github.com/repos/lxc/lxd/pulls/3276/comments","review_comment_url":"https://api.github.com/repos/lxc/lxd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lxc/lxd/issues/3276/comments","statuses_url":"https://api.github.com/repos/lxc/lxd/statuses/1452a5af5fbb144e1b56a9051b647609a810fe92","head":{"label":"freeekanayaka:initial-support-for-preseed-cmdline-option","ref":"initial-support-for-preseed-cmdline-option","sha":"1452a5af5fbb144e1b56a9051b647609a810fe92","user":{"login":"freeekanayaka","id":598445,"avatar_url":"https://avatars3.githubusercontent.com/u/598445?v=3","gravatar_id":"","url":"https://api.github.com/users/freeekanayaka","html_url":"https://github.com/freeekanayaka","followers_url":"https://api.github.com/users/freeekanayaka/followers","following_url":"https://api.github.com/users/freeekanayaka/following{/other_user}","gists_url":"https://api.github.com/users/freeekanayaka/gists{/gist_id}","starred_url":"https://api.github.com/users/freeekanayaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freeekanayaka/subscriptions","organizations_url":"https://api.github.com/users/freeekanayaka/orgs","repos_url":"https://api.github.com/users/freeekanayaka/repos","events_url":"https://api.github.com/users/freeekanayaka/events{/privacy}","received_events_url":"https://api.github.com/users/freeekanayaka/received_events","type":"User","site_admin":false},"repo":{"id":89224639,"name":"lxd","full_name":"freeekanayaka/lxd","owner":{"login":"freeekanayaka","id":598445,"avatar_url":"https://avatars3.githubusercontent.com/u/598445?v=3","gravatar_id":"","url":"https://api.github.com/users/freeekanayaka","html_url":"https://github.com/freeekanayaka","followers_url":"https://api.github.com/users/freeekanayaka/followers","following_url":"https://api.github.com/users/freeekanayaka/following{/other_user}","gists_url":"https://api.github.com/users/freeekanayaka/gists{/gist_id}","starred_url":"https://api.github.com/users/freeekanayaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freeekanayaka/subscriptions","organizations_url":"https://api.github.com/users/freeekanayaka/orgs","repos_url":"https://api.github.com/users/freeekanayaka/repos","events_url":"https://api.github.com/users/freeekanayaka/events{/privacy}","received_events_url":"https://api.github.com/users/freeekanayaka/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/freeekanayaka/lxd","description":"Daemon based on liblxc offering a REST API to manage containers","fork":true,"url":"https://api.github.com/repos/freeekanayaka/lxd","forks_url":"https://api.github.com/repos/freeekanayaka/lxd/forks","keys_url":"https://api.github.com/repos/freeekanayaka/lxd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/freeekanayaka/lxd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/freeekanayaka/lxd/teams","hooks_url":"https://api.github.com/repos/freeekanayaka/lxd/hooks","issue_events_url":"https://api.github.com/repos/freeekanayaka/lxd/issues/events{/number}","events_url":"https://api.github.com/repos/freeekanayaka/lxd/events","assignees_url":"https://api.github.com/repos/freeekanayaka/lxd/assignees{/user}","branches_url":"https://api.github.com/repos/freeekanayaka/lxd/branches{/branch}","tags_url":"https://api.github.com/repos/freeekanayaka/lxd/tags","blobs_url":"https://api.github.com/repos/freeekanayaka/lxd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/freeekanayaka/lxd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/freeekanayaka/lxd/git/refs{/sha}","trees_url":"https://api.github.com/repos/freeekanayaka/lxd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/freeekanayaka/lxd/statuses/{sha}","languages_url":"https://api.github.com/repos/freeekanayaka/lxd/languages","stargazers_url":"https://api.github.com/repos/freeekanayaka/lxd/stargazers","contributors_url":"https://api.github.com/repos/freeekanayaka/lxd/contributors","subscribers_url":"https://api.github.com/repos/freeekanayaka/lxd/subscribers","subscription_url":"https://api.github.com/repos/freeekanayaka/lxd/subscription","commits_url":"https://api.github.com/repos/freeekanayaka/lxd/commits{/sha}","git_commits_url":"https://api.github.com/repos/freeekanayaka/lxd/git/commits{/sha}","comments_url":"https://api.github.com/repos/freeekanayaka/lxd/comments{/number}","issue_comment_url":"https://api.github.com/repos/freeekanayaka/lxd/issues/comments{/number}","contents_url":"https://api.github.com/repos/freeekanayaka/lxd/contents/{+path}","compare_url":"https://api.github.com/repos/freeekanayaka/lxd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/freeekanayaka/lxd/merges","archive_url":"https://api.github.com/repos/freeekanayaka/lxd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/freeekanayaka/lxd/downloads","issues_url":"https://api.github.com/repos/freeekanayaka/lxd/issues{/number}","pulls_url":"https://api.github.com/repos/freeekanayaka/lxd/pulls{/number}","milestones_url":"https://api.github.com/repos/freeekanayaka/lxd/milestones{/number}","notifications_url":"https://api.github.com/repos/freeekanayaka/lxd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/freeekanayaka/lxd/labels{/name}","releases_url":"https://api.github.com/repos/freeekanayaka/lxd/releases{/id}","deployments_url":"https://api.github.com/repos/freeekanayaka/lxd/deployments","created_at":"2017-04-24T09:54:38Z","updated_at":"2017-04-24T09:54:40Z","pushed_at":"2017-05-17T08:11:18Z","git_url":"git://github.com/freeekanayaka/lxd.git","ssh_url":"git@github.com:freeekanayaka/lxd.git","clone_url":"https://github.com/freeekanayaka/lxd.git","svn_url":"https://github.com/freeekanayaka/lxd","homepage":"https://linuxcontainers.org/lxd","size":11613,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"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":"lxc:master","ref":"master","sha":"0f4026a42f5a14bb74996ccca8eac5d30e70b857","user":{"login":"lxc","id":2301756,"avatar_url":"https://avatars1.githubusercontent.com/u/2301756?v=3","gravatar_id":"","url":"https://api.github.com/users/lxc","html_url":"https://github.com/lxc","followers_url":"https://api.github.com/users/lxc/followers","following_url":"https://api.github.com/users/lxc/following{/other_user}","gists_url":"https://api.github.com/users/lxc/gists{/gist_id}","starred_url":"https://api.github.com/users/lxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lxc/subscriptions","organizations_url":"https://api.github.com/users/lxc/orgs","repos_url":"https://api.github.com/users/lxc/repos","events_url":"https://api.github.com/users/lxc/events{/privacy}","received_events_url":"https://api.github.com/users/lxc/received_events","type":"Organization","site_admin":false},"repo":{"id":26192117,"name":"lxd","full_name":"lxc/lxd","owner":{"login":"lxc","id":2301756,"avatar_url":"https://avatars1.githubusercontent.com/u/2301756?v=3","gravatar_id":"","url":"https://api.github.com/users/lxc","html_url":"https://github.com/lxc","followers_url":"https://api.github.com/users/lxc/followers","following_url":"https://api.github.com/users/lxc/following{/other_user}","gists_url":"https://api.github.com/users/lxc/gists{/gist_id}","starred_url":"https://api.github.com/users/lxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lxc/subscriptions","organizations_url":"https://api.github.com/users/lxc/orgs","repos_url":"https://api.github.com/users/lxc/repos","events_url":"https://api.github.com/users/lxc/events{/privacy}","received_events_url":"https://api.github.com/users/lxc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lxc/lxd","description":"Daemon based on liblxc offering a REST API to manage containers","fork":false,"url":"https://api.github.com/repos/lxc/lxd","forks_url":"https://api.github.com/repos/lxc/lxd/forks","keys_url":"https://api.github.com/repos/lxc/lxd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lxc/lxd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lxc/lxd/teams","hooks_url":"https://api.github.com/repos/lxc/lxd/hooks","issue_events_url":"https://api.github.com/repos/lxc/lxd/issues/events{/number}","events_url":"https://api.github.com/repos/lxc/lxd/events","assignees_url":"https://api.github.com/repos/lxc/lxd/assignees{/user}","branches_url":"https://api.github.com/repos/lxc/lxd/branches{/branch}","tags_url":"https://api.github.com/repos/lxc/lxd/tags","blobs_url":"https://api.github.com/repos/lxc/lxd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lxc/lxd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lxc/lxd/git/refs{/sha}","trees_url":"https://api.github.com/repos/lxc/lxd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lxc/lxd/statuses/{sha}","languages_url":"https://api.github.com/repos/lxc/lxd/languages","stargazers_url":"https://api.github.com/repos/lxc/lxd/stargazers","contributors_url":"https://api.github.com/repos/lxc/lxd/contributors","subscribers_url":"https://api.github.com/repos/lxc/lxd/subscribers","subscription_url":"https://api.github.com/repos/lxc/lxd/subscription","commits_url":"https://api.github.com/repos/lxc/lxd/commits{/sha}","git_commits_url":"https://api.github.com/repos/lxc/lxd/git/commits{/sha}","comments_url":"https://api.github.com/repos/lxc/lxd/comments{/number}","issue_comment_url":"https://api.github.com/repos/lxc/lxd/issues/comments{/number}","contents_url":"https://api.github.com/repos/lxc/lxd/contents/{+path}","compare_url":"https://api.github.com/repos/lxc/lxd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lxc/lxd/merges","archive_url":"https://api.github.com/repos/lxc/lxd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lxc/lxd/downloads","issues_url":"https://api.github.com/repos/lxc/lxd/issues{/number}","pulls_url":"https://api.github.com/repos/lxc/lxd/pulls{/number}","milestones_url":"https://api.github.com/repos/lxc/lxd/milestones{/number}","notifications_url":"https://api.github.com/repos/lxc/lxd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lxc/lxd/labels{/name}","releases_url":"https://api.github.com/repos/lxc/lxd/releases{/id}","deployments_url":"https://api.github.com/repos/lxc/lxd/deployments","created_at":"2014-11-04T22:40:52Z","updated_at":"2017-05-16T06:26:32Z","pushed_at":"2017-05-17T08:11:19Z","git_url":"git://github.com/lxc/lxd.git","ssh_url":"git@github.com:lxc/lxd.git","clone_url":"https://github.com/lxc/lxd.git","svn_url":"https://github.com/lxc/lxd","homepage":"https://linuxcontainers.org/lxd","size":11687,"stargazers_count":1347,"watchers_count":1347,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":307,"mirror_url":null,"open_issues_count":76,"forks":307,"open_issues":76,"watchers":1347,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lxc/lxd/pulls/3276"},"html":{"href":"https://github.com/lxc/lxd/pull/3276"},"issue":{"href":"https://api.github.com/repos/lxc/lxd/issues/3276"},"comments":{"href":"https://api.github.com/repos/lxc/lxd/issues/3276/comments"},"review_comments":{"href":"https://api.github.com/repos/lxc/lxd/pulls/3276/comments"},"review_comment":{"href":"https://api.github.com/repos/lxc/lxd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lxc/lxd/pulls/3276/commits"},"statuses":{"href":"https://api.github.com/repos/lxc/lxd/statuses/1452a5af5fbb144e1b56a9051b647609a810fe92"}}}}
{"actor":{"display_login":"freeekanayaka"}}