{"action":"created","comment":{"url":"https://api.github.com/repos/rackspace/rack/pulls/comments/40822822","id":40822822,"diff_hunk":"@@ -0,0 +1,161 @@\n+package stackcommands\n+\n+import (\n+\t\"errors\"\n+\t\"strings\"\n+\n+\t\"github.com/rackspace/rack/commandoptions\"\n+\t\"github.com/rackspace/rack/handler\"\n+\t\"github.com/rackspace/rack/internal/github.com/codegangsta/cli\"\n+\tosStacks \"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks\"\n+\t\"github.com/rackspace/rack/internal/github.com/rackspace/gophercloud/rackspace/orchestration/v1/stacks\"\n+\t\"github.com/rackspace/rack/util\"\n+)\n+\n+var update = cli.Command{\n+\tName:        \"update\",\n+\tUsage:       util.Usage(commandPrefix, \"update\", \"[--name <stackName> | --id <stackID>] [--template-file <templateFile> | --template-url <templateURL>]\"),\n+\tDescription: \"Updates a specified stack\",\n+\tAction:      actionUpdate,\n+\tFlags:       commandoptions.CommandFlags(flagsUpdate, nil),\n+\tBashComplete: func(c *cli.Context) {\n+\t\tcommandoptions.CompleteFlags(commandoptions.CommandFlags(flagsUpdate, keysUpdate))\n+\t},\n+}\n+\n+func flagsUpdate() []cli.Flag {\n+\treturn []cli.Flag{\n+\t\tcli.StringFlag{\n+\t\t\tName:  \"name\",\n+\t\t\tUsage: \"[optional; required if `id` isn't provided] The stack name.\",\n+\t\t},\n+\t\tcli.StringFlag{\n+\t\t\tName:  \"id\",\n+\t\t\tUsage: \"[optional; required if `name` isn't provided] The stack id.\",\n+\t\t},\n+\t\tcli.StringFlag{\n+\t\t\tName:  \"template-file\",\n+\t\t\tUsage: \"[optional; required if `template-url` isn't provided] The path to template file.\",\n+\t\t},\n+\t\tcli.StringFlag{\n+\t\t\tName:  \"template-url\",\n+\t\t\tUsage: \"[optional; required if `template-file` isn't provided] The url to the template.\",\n+\t\t},\n+\t\tcli.StringFlag{\n+\t\t\tName:  \"environment-file\",\n+\t\t\tUsage: \"[optional] File containing environment for the stack\",\n+\t\t},\n+\t\tcli.IntFlag{\n+\t\t\tName:  \"timeout\",\n+\t\t\tUsage: \"[optional] Stack creation timeout in minutes.\",\n+\t\t},\n+\t\tcli.BoolTFlag{\n+\t\t\tName:  \"disable-rollback\",\n+\t\t\tUsage: \"[optional] Disable rollback on create/update failure.\",\n+\t\t},\n+\t\tcli.StringFlag{\n+\t\t\tName:  \"parameters\",\n+\t\t\tUsage: \"[optional] A comma-separated string of key=value pairs.\",\n+\t\t},\n+\t\tcli.StringFlag{\n+\t\t\tName:  \"tags\",\n+\t\t\tUsage: \"[optional] A comma-separated string of tags to associate with the stack.\",\n+\t\t},\n+\t}\n+}\n+\n+type paramsUpdate struct {\n+\topts      *osStacks.UpdateOpts\n+\tstackID   string\n+\tstackName string\n+}\n+\n+var keysUpdate = keysGet\n+\n+type commandUpdate handler.Command\n+\n+func actionUpdate(c *cli.Context) {\n+\tcommand := &commandUpdate{\n+\t\tCtx: &handler.Context{\n+\t\t\tCLIContext: c,\n+\t\t},\n+\t}\n+\thandler.Handle(command)\n+}\n+\n+func (command *commandUpdate) Context() *handler.Context {\n+\treturn command.Ctx\n+}\n+\n+func (command *commandUpdate) Keys() []string {\n+\treturn keysUpdate\n+}\n+\n+func (command *commandUpdate) ServiceClientType() string {\n+\treturn serviceClientType\n+}\n+\n+func (command *commandUpdate) HandleFlags(resource *handler.Resource) error {\n+\tc := command.Ctx.CLIContext\n+\tname := c.String(\"name\")\n+\tid := c.String(\"id\")\n+\tname, id, err := IDAndName(command.Ctx.ServiceClient, name, id)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\topts := &osStacks.UpdateOpts{\n+\t\tTemplateOpts: new(osStacks.Template),\n+\t}\n+\n+\t// check if either template url or template file is set\n+\tif c.IsSet(\"template-file\") {\n+\t\topts.TemplateOpts.URL = c.String(\"template-file\")\n+\t} else if c.IsSet(\"template-url\") {\n+\t\topts.TemplateOpts.URL = c.String(\"template-url\")\n+\t} else {\n+\t\treturn errors.New(\"Neither template-file nor template-url specified\")\n+\t}\n+\n+\tif c.IsSet(\"environment-file\") {\n+\t\topts.EnvironmentOpts = new(osStacks.Environment)\n+\t\topts.EnvironmentOpts.URL = c.String(\"environment-file\")\n+\t}\n+\n+\tif c.IsSet(\"timeout\") {\n+\t\topts.Timeout = c.Int(\"timeout\")\n+\t}\n+\n+\tif c.IsSet(\"parameters\") {\n+\t\tparameters, err := command.Ctx.CheckKVFlag(\"parameters\")\n+\t\tif err != nil {\n+\t\t\treturn err\n+\t\t}\n+\t\topts.Parameters = parameters\n+\t}\n+\n+\tif c.IsSet(\"tags\") {\n+\t\topts.Tags = strings.Split(c.String(\"tags\"), \",\")\n+\t}\n+\n+\tresource.Params = &paramsUpdate{\n+\t\tstackName: name,\n+\t\tstackID:   id,\n+\t\topts:      opts,\n+\t}\n+\treturn nil\n+}\n+\n+func (command *commandUpdate) Execute(resource *handler.Resource) {\n+\tparams := resource.Params.(*paramsUpdate)\n+\topts := params.opts\n+\tstackName := params.stackName\n+\tstackID := params.stackID\n+\tstacks.Update(command.Ctx.ServiceClient, stackName, stackID, opts)","path":"commands/orchestrationcommands/stackcommands/update.go","position":153,"original_position":153,"commit_id":"3734f9b35aae8e4848db5057221cc17dbcdf1730","original_commit_id":"80c8bd69286bcfc166407cdcfc0dd79d7fe7ca21","user":{"login":"jrperritt","id":1733222,"avatar_url":"https://avatars.githubusercontent.com/u/1733222?v=3","gravatar_id":"","url":"https://api.github.com/users/jrperritt","html_url":"https://github.com/jrperritt","followers_url":"https://api.github.com/users/jrperritt/followers","following_url":"https://api.github.com/users/jrperritt/following{/other_user}","gists_url":"https://api.github.com/users/jrperritt/gists{/gist_id}","starred_url":"https://api.github.com/users/jrperritt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrperritt/subscriptions","organizations_url":"https://api.github.com/users/jrperritt/orgs","repos_url":"https://api.github.com/users/jrperritt/repos","events_url":"https://api.github.com/users/jrperritt/events{/privacy}","received_events_url":"https://api.github.com/users/jrperritt/received_events","type":"User","site_admin":false},"body":"We should still check for the error here.\r\n```go\r\nerr := stacks.Update(command.Ctx.ServiceClient, stackName, stackID, opts).ExtractErr()\r\n```","created_at":"2015-09-30T17:20:40Z","updated_at":"2015-09-30T17:20:40Z","html_url":"https://github.com/rackspace/rack/pull/349#discussion_r40822822","pull_request_url":"https://api.github.com/repos/rackspace/rack/pulls/349","_links":{"self":{"href":"https://api.github.com/repos/rackspace/rack/pulls/comments/40822822"},"html":{"href":"https://github.com/rackspace/rack/pull/349#discussion_r40822822"},"pull_request":{"href":"https://api.github.com/repos/rackspace/rack/pulls/349"}}},"pull_request":{"url":"https://api.github.com/repos/rackspace/rack/pulls/349","id":46055981,"html_url":"https://github.com/rackspace/rack/pull/349","diff_url":"https://github.com/rackspace/rack/pull/349.diff","patch_url":"https://github.com/rackspace/rack/pull/349.patch","issue_url":"https://api.github.com/repos/rackspace/rack/issues/349","number":349,"state":"open","locked":false,"title":"[rfr]Add orchestration commands","user":{"login":"pratikmallya","id":904679,"avatar_url":"https://avatars.githubusercontent.com/u/904679?v=3","gravatar_id":"","url":"https://api.github.com/users/pratikmallya","html_url":"https://github.com/pratikmallya","followers_url":"https://api.github.com/users/pratikmallya/followers","following_url":"https://api.github.com/users/pratikmallya/following{/other_user}","gists_url":"https://api.github.com/users/pratikmallya/gists{/gist_id}","starred_url":"https://api.github.com/users/pratikmallya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pratikmallya/subscriptions","organizations_url":"https://api.github.com/users/pratikmallya/orgs","repos_url":"https://api.github.com/users/pratikmallya/repos","events_url":"https://api.github.com/users/pratikmallya/events{/privacy}","received_events_url":"https://api.github.com/users/pratikmallya/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-25T20:42:53Z","updated_at":"2015-09-30T17:20:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f3787ed9b30184442b08ff147cee86a2738dbcf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rackspace/rack/pulls/349/commits","review_comments_url":"https://api.github.com/repos/rackspace/rack/pulls/349/comments","review_comment_url":"https://api.github.com/repos/rackspace/rack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rackspace/rack/issues/349/comments","statuses_url":"https://api.github.com/repos/rackspace/rack/statuses/3734f9b35aae8e4848db5057221cc17dbcdf1730","head":{"label":"pratikmallya:add_orchestration_commands","ref":"add_orchestration_commands","sha":"3734f9b35aae8e4848db5057221cc17dbcdf1730","user":{"login":"pratikmallya","id":904679,"avatar_url":"https://avatars.githubusercontent.com/u/904679?v=3","gravatar_id":"","url":"https://api.github.com/users/pratikmallya","html_url":"https://github.com/pratikmallya","followers_url":"https://api.github.com/users/pratikmallya/followers","following_url":"https://api.github.com/users/pratikmallya/following{/other_user}","gists_url":"https://api.github.com/users/pratikmallya/gists{/gist_id}","starred_url":"https://api.github.com/users/pratikmallya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pratikmallya/subscriptions","organizations_url":"https://api.github.com/users/pratikmallya/orgs","repos_url":"https://api.github.com/users/pratikmallya/repos","events_url":"https://api.github.com/users/pratikmallya/events{/privacy}","received_events_url":"https://api.github.com/users/pratikmallya/received_events","type":"User","site_admin":false},"repo":{"id":40731666,"name":"rack","full_name":"pratikmallya/rack","owner":{"login":"pratikmallya","id":904679,"avatar_url":"https://avatars.githubusercontent.com/u/904679?v=3","gravatar_id":"","url":"https://api.github.com/users/pratikmallya","html_url":"https://github.com/pratikmallya","followers_url":"https://api.github.com/users/pratikmallya/followers","following_url":"https://api.github.com/users/pratikmallya/following{/other_user}","gists_url":"https://api.github.com/users/pratikmallya/gists{/gist_id}","starred_url":"https://api.github.com/users/pratikmallya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pratikmallya/subscriptions","organizations_url":"https://api.github.com/users/pratikmallya/orgs","repos_url":"https://api.github.com/users/pratikmallya/repos","events_url":"https://api.github.com/users/pratikmallya/events{/privacy}","received_events_url":"https://api.github.com/users/pratikmallya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pratikmallya/rack","description":"A CLI for Rackspace","fork":true,"url":"https://api.github.com/repos/pratikmallya/rack","forks_url":"https://api.github.com/repos/pratikmallya/rack/forks","keys_url":"https://api.github.com/repos/pratikmallya/rack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pratikmallya/rack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pratikmallya/rack/teams","hooks_url":"https://api.github.com/repos/pratikmallya/rack/hooks","issue_events_url":"https://api.github.com/repos/pratikmallya/rack/issues/events{/number}","events_url":"https://api.github.com/repos/pratikmallya/rack/events","assignees_url":"https://api.github.com/repos/pratikmallya/rack/assignees{/user}","branches_url":"https://api.github.com/repos/pratikmallya/rack/branches{/branch}","tags_url":"https://api.github.com/repos/pratikmallya/rack/tags","blobs_url":"https://api.github.com/repos/pratikmallya/rack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pratikmallya/rack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pratikmallya/rack/git/refs{/sha}","trees_url":"https://api.github.com/repos/pratikmallya/rack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pratikmallya/rack/statuses/{sha}","languages_url":"https://api.github.com/repos/pratikmallya/rack/languages","stargazers_url":"https://api.github.com/repos/pratikmallya/rack/stargazers","contributors_url":"https://api.github.com/repos/pratikmallya/rack/contributors","subscribers_url":"https://api.github.com/repos/pratikmallya/rack/subscribers","subscription_url":"https://api.github.com/repos/pratikmallya/rack/subscription","commits_url":"https://api.github.com/repos/pratikmallya/rack/commits{/sha}","git_commits_url":"https://api.github.com/repos/pratikmallya/rack/git/commits{/sha}","comments_url":"https://api.github.com/repos/pratikmallya/rack/comments{/number}","issue_comment_url":"https://api.github.com/repos/pratikmallya/rack/issues/comments{/number}","contents_url":"https://api.github.com/repos/pratikmallya/rack/contents/{+path}","compare_url":"https://api.github.com/repos/pratikmallya/rack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pratikmallya/rack/merges","archive_url":"https://api.github.com/repos/pratikmallya/rack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pratikmallya/rack/downloads","issues_url":"https://api.github.com/repos/pratikmallya/rack/issues{/number}","pulls_url":"https://api.github.com/repos/pratikmallya/rack/pulls{/number}","milestones_url":"https://api.github.com/repos/pratikmallya/rack/milestones{/number}","notifications_url":"https://api.github.com/repos/pratikmallya/rack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pratikmallya/rack/labels{/name}","releases_url":"https://api.github.com/repos/pratikmallya/rack/releases{/id}","created_at":"2015-08-14T19:04:18Z","updated_at":"2015-08-14T19:04:19Z","pushed_at":"2015-09-30T16:20:21Z","git_url":"git://github.com/pratikmallya/rack.git","ssh_url":"git@github.com:pratikmallya/rack.git","clone_url":"https://github.com/pratikmallya/rack.git","svn_url":"https://github.com/pratikmallya/rack","homepage":"","size":1890,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rackspace:master","ref":"master","sha":"b3929f9275314ed23cfaedba61a92c4728a44142","user":{"login":"rackspace","id":3949923,"avatar_url":"https://avatars.githubusercontent.com/u/3949923?v=3","gravatar_id":"","url":"https://api.github.com/users/rackspace","html_url":"https://github.com/rackspace","followers_url":"https://api.github.com/users/rackspace/followers","following_url":"https://api.github.com/users/rackspace/following{/other_user}","gists_url":"https://api.github.com/users/rackspace/gists{/gist_id}","starred_url":"https://api.github.com/users/rackspace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackspace/subscriptions","organizations_url":"https://api.github.com/users/rackspace/orgs","repos_url":"https://api.github.com/users/rackspace/repos","events_url":"https://api.github.com/users/rackspace/events{/privacy}","received_events_url":"https://api.github.com/users/rackspace/received_events","type":"Organization","site_admin":false},"repo":{"id":33959631,"name":"rack","full_name":"rackspace/rack","owner":{"login":"rackspace","id":3949923,"avatar_url":"https://avatars.githubusercontent.com/u/3949923?v=3","gravatar_id":"","url":"https://api.github.com/users/rackspace","html_url":"https://github.com/rackspace","followers_url":"https://api.github.com/users/rackspace/followers","following_url":"https://api.github.com/users/rackspace/following{/other_user}","gists_url":"https://api.github.com/users/rackspace/gists{/gist_id}","starred_url":"https://api.github.com/users/rackspace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackspace/subscriptions","organizations_url":"https://api.github.com/users/rackspace/orgs","repos_url":"https://api.github.com/users/rackspace/repos","events_url":"https://api.github.com/users/rackspace/events{/privacy}","received_events_url":"https://api.github.com/users/rackspace/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rackspace/rack","description":"A CLI for Rackspace","fork":false,"url":"https://api.github.com/repos/rackspace/rack","forks_url":"https://api.github.com/repos/rackspace/rack/forks","keys_url":"https://api.github.com/repos/rackspace/rack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackspace/rack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackspace/rack/teams","hooks_url":"https://api.github.com/repos/rackspace/rack/hooks","issue_events_url":"https://api.github.com/repos/rackspace/rack/issues/events{/number}","events_url":"https://api.github.com/repos/rackspace/rack/events","assignees_url":"https://api.github.com/repos/rackspace/rack/assignees{/user}","branches_url":"https://api.github.com/repos/rackspace/rack/branches{/branch}","tags_url":"https://api.github.com/repos/rackspace/rack/tags","blobs_url":"https://api.github.com/repos/rackspace/rack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackspace/rack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackspace/rack/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackspace/rack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackspace/rack/statuses/{sha}","languages_url":"https://api.github.com/repos/rackspace/rack/languages","stargazers_url":"https://api.github.com/repos/rackspace/rack/stargazers","contributors_url":"https://api.github.com/repos/rackspace/rack/contributors","subscribers_url":"https://api.github.com/repos/rackspace/rack/subscribers","subscription_url":"https://api.github.com/repos/rackspace/rack/subscription","commits_url":"https://api.github.com/repos/rackspace/rack/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackspace/rack/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackspace/rack/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackspace/rack/issues/comments{/number}","contents_url":"https://api.github.com/repos/rackspace/rack/contents/{+path}","compare_url":"https://api.github.com/repos/rackspace/rack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackspace/rack/merges","archive_url":"https://api.github.com/repos/rackspace/rack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackspace/rack/downloads","issues_url":"https://api.github.com/repos/rackspace/rack/issues{/number}","pulls_url":"https://api.github.com/repos/rackspace/rack/pulls{/number}","milestones_url":"https://api.github.com/repos/rackspace/rack/milestones{/number}","notifications_url":"https://api.github.com/repos/rackspace/rack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackspace/rack/labels{/name}","releases_url":"https://api.github.com/repos/rackspace/rack/releases{/id}","created_at":"2015-04-14T22:08:59Z","updated_at":"2015-09-21T00:01:46Z","pushed_at":"2015-09-30T16:48:00Z","git_url":"git://github.com/rackspace/rack.git","ssh_url":"git@github.com:rackspace/rack.git","clone_url":"https://github.com/rackspace/rack.git","svn_url":"https://github.com/rackspace/rack","homepage":"","size":3955,"stargazers_count":45,"watchers_count":45,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":36,"forks":26,"open_issues":36,"watchers":45,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rackspace/rack/pulls/349"},"html":{"href":"https://github.com/rackspace/rack/pull/349"},"issue":{"href":"https://api.github.com/repos/rackspace/rack/issues/349"},"comments":{"href":"https://api.github.com/repos/rackspace/rack/issues/349/comments"},"review_comments":{"href":"https://api.github.com/repos/rackspace/rack/pulls/349/comments"},"review_comment":{"href":"https://api.github.com/repos/rackspace/rack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rackspace/rack/pulls/349/commits"},"statuses":{"href":"https://api.github.com/repos/rackspace/rack/statuses/3734f9b35aae8e4848db5057221cc17dbcdf1730"}}}}