OLD | NEW |
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 "os" | 9 "os" |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 func (c *DeployCommand) SetFlags(f *gnuflag.FlagSet) { | 84 func (c *DeployCommand) SetFlags(f *gnuflag.FlagSet) { |
85 c.EnvCommandBase.SetFlags(f) | 85 c.EnvCommandBase.SetFlags(f) |
86 c.UnitCommandBase.SetFlags(f) | 86 c.UnitCommandBase.SetFlags(f) |
87 f.IntVar(&c.NumUnits, "n", 1, "number of service units to deploy for pri
ncipal charms") | 87 f.IntVar(&c.NumUnits, "n", 1, "number of service units to deploy for pri
ncipal charms") |
88 f.BoolVar(&c.BumpRevision, "u", false, "increment local charm directory
revision (DEPRECATED)") | 88 f.BoolVar(&c.BumpRevision, "u", false, "increment local charm directory
revision (DEPRECATED)") |
89 f.BoolVar(&c.BumpRevision, "upgrade", false, "") | 89 f.BoolVar(&c.BumpRevision, "upgrade", false, "") |
90 f.Var(&c.Config, "config", "path to yaml-formatted service config") | 90 f.Var(&c.Config, "config", "path to yaml-formatted service config") |
91 » f.Var(constraints.ConstraintsValue{&c.Constraints}, "constraints", "set
service constraints") | 91 » f.Var(constraints.ConstraintsValue{Target: &c.Constraints}, "constraints
", "set service constraints") |
92 f.StringVar(&c.RepoPath, "repository", os.Getenv(osenv.JujuRepositoryEnv
Key), "local charm repository") | 92 f.StringVar(&c.RepoPath, "repository", os.Getenv(osenv.JujuRepositoryEnv
Key), "local charm repository") |
93 } | 93 } |
94 | 94 |
95 func (c *DeployCommand) Init(args []string) error { | 95 func (c *DeployCommand) Init(args []string) error { |
96 switch len(args) { | 96 switch len(args) { |
97 case 2: | 97 case 2: |
98 if !names.IsService(args[1]) { | 98 if !names.IsService(args[1]) { |
99 return fmt.Errorf("invalid service name %q", args[1]) | 99 return fmt.Errorf("invalid service name %q", args[1]) |
100 } | 100 } |
101 c.ServiceName = args[1] | 101 c.ServiceName = args[1] |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 if err != nil { | 290 if err != nil { |
291 return nil, err | 291 return nil, err |
292 } | 292 } |
293 default: | 293 default: |
294 return nil, fmt.Errorf("unsupported charm URL schema: %q", curl.
Schema) | 294 return nil, fmt.Errorf("unsupported charm URL schema: %q", curl.
Schema) |
295 } | 295 } |
296 report := fmt.Sprintf("Added charm %q to the environment.\n", curl) | 296 report := fmt.Sprintf("Added charm %q to the environment.\n", curl) |
297 ctx.Stdout.Write([]byte(report)) | 297 ctx.Stdout.Write([]byte(report)) |
298 return curl, nil | 298 return curl, nil |
299 } | 299 } |
OLD | NEW |