Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(85)

Delta Between Two Patch Sets: cmd/juju/set.go

Issue 12546043: return error on no environment
Left Patch Set: Created 10 years, 7 months ago
Right Patch Set: return error on no environment Created 10 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « cmd/juju/publish.go ('k') | cmd/juju/unexpose.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2012, 2013 Canonical Ltd. 1 // Copyright 2012, 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package main 4 package main
5 5
6 import ( 6 import (
7 "errors" 7 "errors"
8 "fmt" 8 "fmt"
9 "strings" 9 "strings"
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return err 50 return err
51 } 51 }
52 c.SettingsStrings = settings 52 c.SettingsStrings = settings
53 return nil 53 return nil
54 } 54 }
55 55
56 // Run updates the configuration of a service. 56 // Run updates the configuration of a service.
57 func (c *SetCommand) Run(ctx *cmd.Context) error { 57 func (c *SetCommand) Run(ctx *cmd.Context) error {
58 conn, err := juju.NewConnFromName(c.EnvName) 58 conn, err := juju.NewConnFromName(c.EnvName)
59 if err != nil { 59 if err != nil {
60 » » return c.envOpenFailure(err, ctx.Stderr) 60 » » return err
61 } 61 }
62 defer conn.Close() 62 defer conn.Close()
63 service, err := conn.State.Service(c.ServiceName) 63 service, err := conn.State.Service(c.ServiceName)
64 if err != nil { 64 if err != nil {
65 return err 65 return err
66 } 66 }
67 ch, _, err := service.Charm() 67 ch, _, err := service.Charm()
68 if err != nil { 68 if err != nil {
69 return err 69 return err
70 } 70 }
(...skipping 25 matching lines...) Expand all
96 kv := make(map[string]string) 96 kv := make(map[string]string)
97 for _, o := range options { 97 for _, o := range options {
98 s := strings.SplitN(o, "=", 2) 98 s := strings.SplitN(o, "=", 2)
99 if len(s) != 2 || s[0] == "" { 99 if len(s) != 2 || s[0] == "" {
100 return nil, fmt.Errorf("invalid option: %q", o) 100 return nil, fmt.Errorf("invalid option: %q", o)
101 } 101 }
102 kv[s[0]] = s[1] 102 kv[s[0]] = s[1]
103 } 103 }
104 return kv, nil 104 return kv, nil
105 } 105 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b