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

Side by Side Diff: cmd/juju/unexpose.go

Issue 7370043: Change the way aliases to subcommands are handled.
Patch Set: Change the way aliases to subcommands are handled. Created 12 years, 1 month 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 | « cmd/juju/status.go ('k') | cmd/juju/upgradejuju.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 package main 1 package main
2 2
3 import ( 3 import (
4 "errors" 4 "errors"
5 5
6 "launchpad.net/gnuflag" 6 "launchpad.net/gnuflag"
7 "launchpad.net/juju-core/cmd" 7 "launchpad.net/juju-core/cmd"
8 "launchpad.net/juju-core/juju" 8 "launchpad.net/juju-core/juju"
9 ) 9 )
10 10
11 // UnexposeCommand is responsible exposing services. 11 // UnexposeCommand is responsible exposing services.
12 type UnexposeCommand struct { 12 type UnexposeCommand struct {
13 EnvName string 13 EnvName string
14 ServiceName string 14 ServiceName string
15 } 15 }
16 16
17 func (c *UnexposeCommand) Info() *cmd.Info { 17 func (c *UnexposeCommand) Info() *cmd.Info {
18 » return &cmd.Info{"unexpose", "", "unexpose a service", ""} 18 » return &cmd.Info{
19 » » Name: "unexpose",
20 » » Args: "<service>",
21 » » Purpose: "unexpose a service",
22 » }
19 } 23 }
20 24
21 func (c *UnexposeCommand) SetFlags(f *gnuflag.FlagSet) { 25 func (c *UnexposeCommand) SetFlags(f *gnuflag.FlagSet) {
22 addEnvironFlags(&c.EnvName, f) 26 addEnvironFlags(&c.EnvName, f)
23 } 27 }
24 28
25 func (c *UnexposeCommand) Init(args []string) error { 29 func (c *UnexposeCommand) Init(args []string) error {
26 if len(args) == 0 { 30 if len(args) == 0 {
27 return errors.New("no service name specified") 31 return errors.New("no service name specified")
28 } 32 }
29 c.ServiceName = args[0] 33 c.ServiceName = args[0]
30 return cmd.CheckEmpty(args[1:]) 34 return cmd.CheckEmpty(args[1:])
31 } 35 }
32 36
33 // Run changes the juju-managed firewall to hide any 37 // Run changes the juju-managed firewall to hide any
34 // ports that were also explicitly marked by units as closed. 38 // ports that were also explicitly marked by units as closed.
35 func (c *UnexposeCommand) Run(_ *cmd.Context) error { 39 func (c *UnexposeCommand) Run(_ *cmd.Context) error {
36 conn, err := juju.NewConnFromName(c.EnvName) 40 conn, err := juju.NewConnFromName(c.EnvName)
37 if err != nil { 41 if err != nil {
38 return err 42 return err
39 } 43 }
40 defer conn.Close() 44 defer conn.Close()
41 svc, err := conn.State.Service(c.ServiceName) 45 svc, err := conn.State.Service(c.ServiceName)
42 if err != nil { 46 if err != nil {
43 return err 47 return err
44 } 48 }
45 return svc.ClearExposed() 49 return svc.ClearExposed()
46 } 50 }
OLDNEW
« no previous file with comments | « cmd/juju/status.go ('k') | cmd/juju/upgradejuju.go » ('j') | no next file with comments »

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