Merge lp:~axwalk/juju-core/lp1313960-bootstrap-to into lp:~go-bot/juju-core/trunk

Proposed by Andrew Wilkins
Status: Merged
Approved by: Andrew Wilkins
Approved revision: no longer in the source branch.
Merged at revision: 2687
Proposed branch: lp:~axwalk/juju-core/lp1313960-bootstrap-to
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 69 lines (+13/-19)
2 files modified
cmd/juju/bootstrap.go (+9/-15)
cmd/juju/bootstrap_test.go (+4/-4)
To merge this branch: bzr merge lp:~axwalk/juju-core/lp1313960-bootstrap-to
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+217837@code.launchpad.net

Commit message

cmd/juju: bootstrap --to <placement>

Change bootstrap to use "--to <placement>",
to make way for repurposing positional args.

Fixes lp:1313960

https://codereview.appspot.com/90970043/

Description of the change

cmd/juju: bootstrap --to <placement>

Change bootstrap to use "--to <placement>",
to make way for repurposing positional args.

Fixes lp:1313960

https://codereview.appspot.com/90970043/

To post a comment you must log in.
Revision history for this message
Andrew Wilkins (axwalk) wrote :
Download full text (3.3 KiB)

Reviewers: mp+217837_code.launchpad.net,

Message:
Please take a look.

Description:
cmd/juju: bootstrap --to <placement>

Change bootstrap to use "--to <placement>",
to make way for repurposing positional args.

Fixes lp:1313960

https://code.launchpad.net/~axwalk/juju-core/lp1313960-bootstrap-to/+merge/217837

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/90970043/

Affected files (+15, -19 lines):
   A [revision details]
   M cmd/juju/bootstrap.go
   M cmd/juju/bootstrap_test.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20140430030329-cl8i2buuaypidtg4
+New revision: <email address hidden>

Index: cmd/juju/bootstrap.go
=== modified file 'cmd/juju/bootstrap.go'
--- cmd/juju/bootstrap.go 2014-04-24 12:33:19 +0000
+++ cmd/juju/bootstrap.go 2014-04-30 22:05:31 +0000
@@ -72,7 +72,6 @@
  func (c *BootstrapCommand) Info() *cmd.Info {
   return &cmd.Info{
    Name: "bootstrap",
- Args: "[placement]",
    Purpose: "start up an environment from scratch",
    Doc: bootstrapDoc,
   }
@@ -84,6 +83,7 @@
   f.BoolVar(&c.UploadTools, "upload-tools", false, "upload local version of
tools before bootstrapping")
   f.Var(seriesVar{&c.Series}, "series", "upload tools for supplied
comma-separated series list")
   f.StringVar(&c.MetadataSource, "metadata-source", "", "local path to use
as tools and/or metadata source")
+ f.StringVar(&c.Placement, "to", "", "a placement directive indicating an
instance to bootstrap")
  }

  func (c *BootstrapCommand) Init(args []string) (err error) {
@@ -96,20 +96,14 @@
   }
   // Parse the placement directive. Bootstrap currently only
   // supports provider-specific placement directives.
- placement, err := cmd.ZeroOrOneArgs(args)
- if err != nil {
- return err
- }
- if placement == "" {
- return nil
- }
- _, err = instance.ParsePlacement(placement)
- if err != instance.ErrPlacementScopeMissing {
- // We only support unscoped placement directives for bootstrap.
- return fmt.Errorf("unsupported bootstrap placement directive %q",
placement)
- }
- c.Placement = placement
- return nil
+ if c.Placement != "" {
+ _, err = instance.ParsePlacement(c.Placement)
+ if err != instance.ErrPlacementScopeMissing {
+ // We only support unscoped placement directives for bootstrap.
+ return fmt.Errorf("unsupported bootstrap placement directive %q",
c.Placement)
+ }
+ }
+ return cmd.CheckEmpty(args)
  }

  // Run connects to the environment specified on the command line and
bootstraps

Index: cmd/juju/bootstrap_test.go
=== modified file 'cmd/juju/bootstrap_test.go'
--- cmd/juju/bootstrap_test.go 2014-04-25 04:23:08 +0000
+++ cmd/juju/bootstrap_test.go 2014-04-30 22:05:31 +0000
@@ -376,12 +376,12 @@
   },
  }, {
   info: "placement",
- args: []string{"something"},
+ args: []string{"--to", "something"},
   placement: "something",
  }, {
- info: "invalid placement: ssh",
- args: []string{"ssh:someplace"},
- err: `unsupported bootstrap placement dire...

Read more...

Revision history for this message
Ian Booth (wallyworld) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmd/juju/bootstrap.go'
2--- cmd/juju/bootstrap.go 2014-04-24 12:33:19 +0000
3+++ cmd/juju/bootstrap.go 2014-04-30 22:07:50 +0000
4@@ -72,7 +72,6 @@
5 func (c *BootstrapCommand) Info() *cmd.Info {
6 return &cmd.Info{
7 Name: "bootstrap",
8- Args: "[placement]",
9 Purpose: "start up an environment from scratch",
10 Doc: bootstrapDoc,
11 }
12@@ -84,6 +83,7 @@
13 f.BoolVar(&c.UploadTools, "upload-tools", false, "upload local version of tools before bootstrapping")
14 f.Var(seriesVar{&c.Series}, "series", "upload tools for supplied comma-separated series list")
15 f.StringVar(&c.MetadataSource, "metadata-source", "", "local path to use as tools and/or metadata source")
16+ f.StringVar(&c.Placement, "to", "", "a placement directive indicating an instance to bootstrap")
17 }
18
19 func (c *BootstrapCommand) Init(args []string) (err error) {
20@@ -96,20 +96,14 @@
21 }
22 // Parse the placement directive. Bootstrap currently only
23 // supports provider-specific placement directives.
24- placement, err := cmd.ZeroOrOneArgs(args)
25- if err != nil {
26- return err
27- }
28- if placement == "" {
29- return nil
30- }
31- _, err = instance.ParsePlacement(placement)
32- if err != instance.ErrPlacementScopeMissing {
33- // We only support unscoped placement directives for bootstrap.
34- return fmt.Errorf("unsupported bootstrap placement directive %q", placement)
35- }
36- c.Placement = placement
37- return nil
38+ if c.Placement != "" {
39+ _, err = instance.ParsePlacement(c.Placement)
40+ if err != instance.ErrPlacementScopeMissing {
41+ // We only support unscoped placement directives for bootstrap.
42+ return fmt.Errorf("unsupported bootstrap placement directive %q", c.Placement)
43+ }
44+ }
45+ return cmd.CheckEmpty(args)
46 }
47
48 // Run connects to the environment specified on the command line and bootstraps
49
50=== modified file 'cmd/juju/bootstrap_test.go'
51--- cmd/juju/bootstrap_test.go 2014-04-25 04:23:08 +0000
52+++ cmd/juju/bootstrap_test.go 2014-04-30 22:07:50 +0000
53@@ -376,12 +376,12 @@
54 },
55 }, {
56 info: "placement",
57- args: []string{"something"},
58+ args: []string{"--to", "something"},
59 placement: "something",
60 }, {
61- info: "invalid placement: ssh",
62- args: []string{"ssh:someplace"},
63- err: `unsupported bootstrap placement directive "ssh:someplace"`,
64+ info: "additional args",
65+ args: []string{"anything", "else"},
66+ err: `unrecognized args: \["anything" "else"\]`,
67 }}
68
69 func (s *BootstrapSuite) TestBootstrapTwice(c *gc.C) {

Subscribers

People subscribed via source and target branches

to status/vote changes: