{"action":"created","comment":{"url":"https://api.github.com/repos/juju/juju/pulls/comments/82791021","pull_request_review_id":3673158,"id":82791021,"diff_hunk":"@@ -0,0 +1,82 @@\n+// Copyright 2016 Canonical Ltd.\n+// Licensed under the AGPLv3, see LICENCE file for details.\n+\n+package common\n+\n+import (\n+\t\"fmt\"\n+\t\"io\"\n+\n+\t\"github.com/juju/juju/apiserver/params\"\n+\n+\t\"github.com/juju/errors\"\n+)\n+\n+// ProvisioningClientAPI defines the methods that are needed for the manual\n+// provisioning of machines.  An interface is used here to decouple the API\n+// consumer from the actual API implementation type.\n+type ProvisioningClientAPI interface {\n+\tAddMachines([]params.AddMachineParams) ([]params.AddMachinesResult, error)\n+\tForceDestroyMachines(machines ...string) error\n+\tProvisioningScript(params.ProvisioningScriptParams) (script string, err error)\n+}\n+\n+var (\n+\t// ErrProvisioned is returned by ProvisionMachine if the target\n+\t// machine has an existing machine agent.\n+\tErrProvisioned = errors.New(\"machine is already provisioned\")\n+\t// ErrNoProtoScope is returned on ProvisionMachine when we are not in the ssh\n+\t// or winrm scope and we must continue the provisioning process\n+\tErrNoProtoScope = fmt.Errorf(\"No winrm/ssh scope\")\n+)\n+\n+const ManualInstancePrefix = \"manual:\"\n+\n+type ProvisionMachineArgs struct {\n+\t// user and host of the ssh or winrm conn\n+\tHost string\n+\tUser string\n+\n+\t// DataDir is the root directory for juju data.\n+\t// If left blank, the default location \"/var/lib/juju\" will be used.\n+\tDataDir string\n+\n+\t// Client provides the API needed to provision the machines.\n+\tClient ProvisioningClientAPI\n+\n+\t// Stdin is required to respond to sudo prompts,\n+\t// and must be a terminal (except in tests)\n+\tStdin io.Reader\n+\n+\t// Stdout is required to present sudo prompts to the user.\n+\tStdout io.Writer\n+\n+\t// Stderr is required to present machine provisioning progress to the user.\n+\tStderr io.Writer\n+\n+\t// AuthorizedKeys contains the concatenated authorized-keys to add to the\n+\t// ubuntu user's ~/.ssh/authorized_keys.\n+\tAuthorizedKeys string\n+\n+\t*params.UpdateBehavior\n+}\n+\n+// ScriptProvisioner used to determine the script that will be used to\n+// manual provision a machine linux or windows machine.\n+type ScriptProvisioner interface {","path":"environs/manual/common/common.go","position":66,"original_position":66,"commit_id":"3864613a4d7af1b53d33ee0e25667b8b07c5ae32","original_commit_id":"3f92ff61083bbf642b17472e75e7ff9be9aa3c1d","user":{"login":"hoenirvili","id":8754546,"avatar_url":"https://avatars.githubusercontent.com/u/8754546?v=3","gravatar_id":"","url":"https://api.github.com/users/hoenirvili","html_url":"https://github.com/hoenirvili","followers_url":"https://api.github.com/users/hoenirvili/followers","following_url":"https://api.github.com/users/hoenirvili/following{/other_user}","gists_url":"https://api.github.com/users/hoenirvili/gists{/gist_id}","starred_url":"https://api.github.com/users/hoenirvili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoenirvili/subscriptions","organizations_url":"https://api.github.com/users/hoenirvili/orgs","repos_url":"https://api.github.com/users/hoenirvili/repos","events_url":"https://api.github.com/users/hoenirvili/events{/privacy}","received_events_url":"https://api.github.com/users/hoenirvili/received_events","type":"User","site_admin":false},"body":"If you look closely @axw in **manual/linux/linux.go:276** in this function is the linux(aka sshprovisioner script generation).For a windows provisioning standpoint we don't need unsupported things enabled.\r\n```go\r\n cloudcfg.SetSystemUpdate(s.icfg.EnableOSRefreshUpdate)\r\n cloudcfg.SetSystemUpgrade(s.icfg.EnableOSUpgrade)\r\n```\r\nor wrapper functions around **bash** scripts like\r\n```go\r\nfmt.Fprintf(&buf, \"rm -f %s\\n\", utils.ShQuote(s.icfg.CloudInitOutputLog))\r\n```\r\nYeah I know this line retuns (in a transparent way) different implementations based on different series. \r\n```go\r\nudata, err := cloudconfig.NewUserdataConfig(s.icfg, cloudcfg) \r\n```\r\nBut when a windows specific series is chosen, we don't need all of this extra bash/ssh specific things around our script generation, instead we need our winrm (*this will be contained in the future patch that I will send, as a side note*) specific things. So instead of cluttering the ssh and the winrm code together ,I decoupled them in multiple implementations on the same interface type.","created_at":"2016-10-11T13:26:26Z","updated_at":"2016-10-11T13:26:26Z","html_url":"https://github.com/juju/juju/pull/6414#discussion_r82791021","pull_request_url":"https://api.github.com/repos/juju/juju/pulls/6414","_links":{"self":{"href":"https://api.github.com/repos/juju/juju/pulls/comments/82791021"},"html":{"href":"https://github.com/juju/juju/pull/6414#discussion_r82791021"},"pull_request":{"href":"https://api.github.com/repos/juju/juju/pulls/6414"}}},"pull_request":{"url":"https://api.github.com/repos/juju/juju/pulls/6414","id":88610762,"html_url":"https://github.com/juju/juju/pull/6414","diff_url":"https://github.com/juju/juju/pull/6414.diff","patch_url":"https://github.com/juju/juju/pull/6414.patch","issue_url":"https://api.github.com/repos/juju/juju/issues/6414","number":6414,"state":"open","locked":false,"title":"Refactor linux manual provider code.","user":{"login":"hoenirvili","id":8754546,"avatar_url":"https://avatars.githubusercontent.com/u/8754546?v=3","gravatar_id":"","url":"https://api.github.com/users/hoenirvili","html_url":"https://github.com/hoenirvili","followers_url":"https://api.github.com/users/hoenirvili/followers","following_url":"https://api.github.com/users/hoenirvili/following{/other_user}","gists_url":"https://api.github.com/users/hoenirvili/gists{/gist_id}","starred_url":"https://api.github.com/users/hoenirvili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoenirvili/subscriptions","organizations_url":"https://api.github.com/users/hoenirvili/orgs","repos_url":"https://api.github.com/users/hoenirvili/repos","events_url":"https://api.github.com/users/hoenirvili/events{/privacy}","received_events_url":"https://api.github.com/users/hoenirvili/received_events","type":"User","site_admin":false},"body":"This patch contains modifications in the linux manual provision code path.\r\nIt makes the code much more robust, makes it more flexible through changes adding more interfaces.\r\nAfter this patch, we can easily add multiple transparent ways of manual provisioning a\r\nmachine therefore, making it easier to enable manual provisioning for windows\r\nmachines.(this will be followed by the patch for manual windows provisioning).","created_at":"2016-10-10T05:11:19Z","updated_at":"2016-10-11T13:26:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"72543290f7b6ec9449bc4d2657ee272775289d02","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/juju/juju/pulls/6414/commits","review_comments_url":"https://api.github.com/repos/juju/juju/pulls/6414/comments","review_comment_url":"https://api.github.com/repos/juju/juju/pulls/comments{/number}","comments_url":"https://api.github.com/repos/juju/juju/issues/6414/comments","statuses_url":"https://api.github.com/repos/juju/juju/statuses/3864613a4d7af1b53d33ee0e25667b8b07c5ae32","head":{"label":"hoenirvili:refactor-manual-linux","ref":"refactor-manual-linux","sha":"3864613a4d7af1b53d33ee0e25667b8b07c5ae32","user":{"login":"hoenirvili","id":8754546,"avatar_url":"https://avatars.githubusercontent.com/u/8754546?v=3","gravatar_id":"","url":"https://api.github.com/users/hoenirvili","html_url":"https://github.com/hoenirvili","followers_url":"https://api.github.com/users/hoenirvili/followers","following_url":"https://api.github.com/users/hoenirvili/following{/other_user}","gists_url":"https://api.github.com/users/hoenirvili/gists{/gist_id}","starred_url":"https://api.github.com/users/hoenirvili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoenirvili/subscriptions","organizations_url":"https://api.github.com/users/hoenirvili/orgs","repos_url":"https://api.github.com/users/hoenirvili/repos","events_url":"https://api.github.com/users/hoenirvili/events{/privacy}","received_events_url":"https://api.github.com/users/hoenirvili/received_events","type":"User","site_admin":false},"repo":{"id":63775101,"name":"juju","full_name":"hoenirvili/juju","owner":{"login":"hoenirvili","id":8754546,"avatar_url":"https://avatars.githubusercontent.com/u/8754546?v=3","gravatar_id":"","url":"https://api.github.com/users/hoenirvili","html_url":"https://github.com/hoenirvili","followers_url":"https://api.github.com/users/hoenirvili/followers","following_url":"https://api.github.com/users/hoenirvili/following{/other_user}","gists_url":"https://api.github.com/users/hoenirvili/gists{/gist_id}","starred_url":"https://api.github.com/users/hoenirvili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoenirvili/subscriptions","organizations_url":"https://api.github.com/users/hoenirvili/orgs","repos_url":"https://api.github.com/users/hoenirvili/repos","events_url":"https://api.github.com/users/hoenirvili/events{/privacy}","received_events_url":"https://api.github.com/users/hoenirvili/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hoenirvili/juju","description":"juju is devops distilled","fork":true,"url":"https://api.github.com/repos/hoenirvili/juju","forks_url":"https://api.github.com/repos/hoenirvili/juju/forks","keys_url":"https://api.github.com/repos/hoenirvili/juju/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hoenirvili/juju/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hoenirvili/juju/teams","hooks_url":"https://api.github.com/repos/hoenirvili/juju/hooks","issue_events_url":"https://api.github.com/repos/hoenirvili/juju/issues/events{/number}","events_url":"https://api.github.com/repos/hoenirvili/juju/events","assignees_url":"https://api.github.com/repos/hoenirvili/juju/assignees{/user}","branches_url":"https://api.github.com/repos/hoenirvili/juju/branches{/branch}","tags_url":"https://api.github.com/repos/hoenirvili/juju/tags","blobs_url":"https://api.github.com/repos/hoenirvili/juju/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hoenirvili/juju/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hoenirvili/juju/git/refs{/sha}","trees_url":"https://api.github.com/repos/hoenirvili/juju/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hoenirvili/juju/statuses/{sha}","languages_url":"https://api.github.com/repos/hoenirvili/juju/languages","stargazers_url":"https://api.github.com/repos/hoenirvili/juju/stargazers","contributors_url":"https://api.github.com/repos/hoenirvili/juju/contributors","subscribers_url":"https://api.github.com/repos/hoenirvili/juju/subscribers","subscription_url":"https://api.github.com/repos/hoenirvili/juju/subscription","commits_url":"https://api.github.com/repos/hoenirvili/juju/commits{/sha}","git_commits_url":"https://api.github.com/repos/hoenirvili/juju/git/commits{/sha}","comments_url":"https://api.github.com/repos/hoenirvili/juju/comments{/number}","issue_comment_url":"https://api.github.com/repos/hoenirvili/juju/issues/comments{/number}","contents_url":"https://api.github.com/repos/hoenirvili/juju/contents/{+path}","compare_url":"https://api.github.com/repos/hoenirvili/juju/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hoenirvili/juju/merges","archive_url":"https://api.github.com/repos/hoenirvili/juju/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hoenirvili/juju/downloads","issues_url":"https://api.github.com/repos/hoenirvili/juju/issues{/number}","pulls_url":"https://api.github.com/repos/hoenirvili/juju/pulls{/number}","milestones_url":"https://api.github.com/repos/hoenirvili/juju/milestones{/number}","notifications_url":"https://api.github.com/repos/hoenirvili/juju/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hoenirvili/juju/labels{/name}","releases_url":"https://api.github.com/repos/hoenirvili/juju/releases{/id}","deployments_url":"https://api.github.com/repos/hoenirvili/juju/deployments","created_at":"2016-07-20T11:10:49Z","updated_at":"2016-07-20T11:10:59Z","pushed_at":"2016-10-11T13:26:24Z","git_url":"git://github.com/hoenirvili/juju.git","ssh_url":"git@github.com:hoenirvili/juju.git","clone_url":"https://github.com/hoenirvili/juju.git","svn_url":"https://github.com/hoenirvili/juju","homepage":"juju.ubuntu.com","size":96648,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"juju:master","ref":"master","sha":"0e433614cc9aa62b0834eea3b64c079c953109d8","user":{"login":"juju","id":4604548,"avatar_url":"https://avatars.githubusercontent.com/u/4604548?v=3","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"repo":{"id":20445947,"name":"juju","full_name":"juju/juju","owner":{"login":"juju","id":4604548,"avatar_url":"https://avatars.githubusercontent.com/u/4604548?v=3","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juju/juju","description":"juju is devops distilled","fork":false,"url":"https://api.github.com/repos/juju/juju","forks_url":"https://api.github.com/repos/juju/juju/forks","keys_url":"https://api.github.com/repos/juju/juju/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juju/juju/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juju/juju/teams","hooks_url":"https://api.github.com/repos/juju/juju/hooks","issue_events_url":"https://api.github.com/repos/juju/juju/issues/events{/number}","events_url":"https://api.github.com/repos/juju/juju/events","assignees_url":"https://api.github.com/repos/juju/juju/assignees{/user}","branches_url":"https://api.github.com/repos/juju/juju/branches{/branch}","tags_url":"https://api.github.com/repos/juju/juju/tags","blobs_url":"https://api.github.com/repos/juju/juju/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juju/juju/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juju/juju/git/refs{/sha}","trees_url":"https://api.github.com/repos/juju/juju/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juju/juju/statuses/{sha}","languages_url":"https://api.github.com/repos/juju/juju/languages","stargazers_url":"https://api.github.com/repos/juju/juju/stargazers","contributors_url":"https://api.github.com/repos/juju/juju/contributors","subscribers_url":"https://api.github.com/repos/juju/juju/subscribers","subscription_url":"https://api.github.com/repos/juju/juju/subscription","commits_url":"https://api.github.com/repos/juju/juju/commits{/sha}","git_commits_url":"https://api.github.com/repos/juju/juju/git/commits{/sha}","comments_url":"https://api.github.com/repos/juju/juju/comments{/number}","issue_comment_url":"https://api.github.com/repos/juju/juju/issues/comments{/number}","contents_url":"https://api.github.com/repos/juju/juju/contents/{+path}","compare_url":"https://api.github.com/repos/juju/juju/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juju/juju/merges","archive_url":"https://api.github.com/repos/juju/juju/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juju/juju/downloads","issues_url":"https://api.github.com/repos/juju/juju/issues{/number}","pulls_url":"https://api.github.com/repos/juju/juju/pulls{/number}","milestones_url":"https://api.github.com/repos/juju/juju/milestones{/number}","notifications_url":"https://api.github.com/repos/juju/juju/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juju/juju/labels{/name}","releases_url":"https://api.github.com/repos/juju/juju/releases{/id}","deployments_url":"https://api.github.com/repos/juju/juju/deployments","created_at":"2014-06-03T14:28:10Z","updated_at":"2016-10-07T01:19:13Z","pushed_at":"2016-10-11T13:26:24Z","git_url":"git://github.com/juju/juju.git","ssh_url":"git@github.com:juju/juju.git","clone_url":"https://github.com/juju/juju.git","svn_url":"https://github.com/juju/juju","homepage":"juju.ubuntu.com","size":126785,"stargazers_count":516,"watchers_count":516,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":158,"mirror_url":null,"open_issues_count":22,"forks":158,"open_issues":22,"watchers":516,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/juju/juju/pulls/6414"},"html":{"href":"https://github.com/juju/juju/pull/6414"},"issue":{"href":"https://api.github.com/repos/juju/juju/issues/6414"},"comments":{"href":"https://api.github.com/repos/juju/juju/issues/6414/comments"},"review_comments":{"href":"https://api.github.com/repos/juju/juju/pulls/6414/comments"},"review_comment":{"href":"https://api.github.com/repos/juju/juju/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/juju/juju/pulls/6414/commits"},"statuses":{"href":"https://api.github.com/repos/juju/juju/statuses/3864613a4d7af1b53d33ee0e25667b8b07c5ae32"}}}}
{"actor":{"display_login":"hoenirvili"}}