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

Side by Side Diff: state/statecmd/addunit.go

Issue 8716043: Make AddServiceUnits API call return unit names
Patch Set: Make AddServiceUnits API call return unit names Created 10 years, 11 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:
View unified diff | Download patch
« no previous file with comments | « state/apiserver/apiserver.go ('k') | state/statecmd/addunit_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Code shared by the CLI and API for the ServiceAddUnit function. 1 // Code shared by the CLI and API for the ServiceAddUnit function.
2 2
3 package statecmd 3 package statecmd
4 4
5 import ( 5 import (
6 "errors" 6 "errors"
7 "launchpad.net/juju-core/juju" 7 "launchpad.net/juju-core/juju"
8 "launchpad.net/juju-core/state" 8 "launchpad.net/juju-core/state"
9 "launchpad.net/juju-core/state/api/params" 9 "launchpad.net/juju-core/state/api/params"
10 ) 10 )
11 11
12 // AddServiceUnits adds a given number of units to a service. 12 // AddServiceUnits adds a given number of units to a service.
13 func AddServiceUnits(state *state.State, args params.AddServiceUnits) error { 13 func AddServiceUnits(state *state.State, args params.AddServiceUnits) ([]*state. Unit, error) {
14 conn, err := juju.NewConnFromState(state) 14 conn, err := juju.NewConnFromState(state)
15 if err != nil { 15 if err != nil {
16 » » return err 16 » » return nil, err
17 } 17 }
18 service, err := state.Service(args.ServiceName) 18 service, err := state.Service(args.ServiceName)
19 if err != nil { 19 if err != nil {
20 » » return err 20 » » return nil, err
21 } 21 }
22 if args.NumUnits < 1 { 22 if args.NumUnits < 1 {
23 » » return errors.New("must add at least one unit") 23 » » return nil, errors.New("must add at least one unit")
24 } 24 }
25 » _, err = conn.AddUnits(service, args.NumUnits) 25 » return conn.AddUnits(service, args.NumUnits)
26 » return err
27 } 26 }
OLDNEW
« no previous file with comments | « state/apiserver/apiserver.go ('k') | state/statecmd/addunit_test.go » ('j') | no next file with comments »

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