Description:
cmd/juju/ensureavailability: default to 3 servers
I filed bug #1311083 because we currently have a default of '-1' and we
immediately fail when running the command. I don't think this is very
good UI for a user. I think we can make an opinionated statement that
n=3 is going to be the best for someone who wants to run this command.
And that is what this patch does.
Index: cmd/juju/ensureavailability.go
=== modified file 'cmd/juju/ensureavailability.go'
--- cmd/juju/ensureavailability.go 2014-04-01 04:53:43 +0000
+++ cmd/juju/ensureavailability.go 2014-04-22 12:28:07 +0000
@@ -33,7 +33,7 @@
An odd number of state servers is required.
Examples:
- juju ensure-availability -n 3
+ juju ensure-availability
Ensure that 3 state servers are available,
with newly created state server machines
having the default series and constraints.
@@ -58,7 +58,7 @@
func (c *EnsureAvailabilityCommand) SetFlags(f *gnuflag.FlagSet) {
c.EnvCommandBase.SetFlags(f)
- f.IntVar(&c.NumStateServers, "n", -1, "number of state servers to make
available")
+ f.IntVar(&c.NumStateServers, "n", 3, "number of state servers to make
available")
f.StringVar(&c.Series, "series", "", "the charm series")
Reviewers: mp+216706_ code.launchpad. net,
Message:
Please take a look.
Description: ensureavailabil ity: default to 3 servers
cmd/juju/
I filed bug #1311083 because we currently have a default of '-1' and we
immediately fail when running the command. I don't think this is very
good UI for a user. I think we can make an opinionated statement that
n=3 is going to be the best for someone who wants to run this command.
And that is what this patch does.
https:/ /code.launchpad .net/~jameinel/ juju-core/ ensure- availability- default- 3-1311083/ +merge/ 216706
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/90160044/
Affected files (+13, -5 lines): ensureavailabil ity.go ensureavailabil ity_test. go
A [revision details]
M cmd/juju/
M cmd/juju/
Index: [revision details] 20140422051657- 1svpzqvmysbn4tq m
=== 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-
+New revision: <email address hidden>
Index: cmd/juju/ ensureavailabil ity.go ensureavailabil ity.go' ensureavailabil ity.go 2014-04-01 04:53:43 +0000 ensureavailabil ity.go 2014-04-22 12:28:07 +0000
=== modified file 'cmd/juju/
--- cmd/juju/
+++ cmd/juju/
@@ -33,7 +33,7 @@
An odd number of state servers is required.
Examples:
- juju ensure-availability -n 3
+ juju ensure-availability
Ensure that 3 state servers are available,
with newly created state server machines
having the default series and constraints.
@@ -58,7 +58,7 @@
func (c *EnsureAvailabi lityCommand) SetFlags(f *gnuflag.FlagSet) { Base.SetFlags( f) &c.NumStateServ ers, "n", -1, "number of state servers to make &c.NumStateServ ers, "n", 3, "number of state servers to make &c.Series, "series", "", "the charm series")
c.EnvCommand
- f.IntVar(
available")
+ f.IntVar(
available")
f.StringVar(
f.Var(constrain ts.ConstraintsV alue{&c. Constraints} , "constraints", "additional
machine constraints")
}
Index: cmd/juju/ ensureavailabil ity_test. go ensureavailabil ity_test. go' ensureavailabil ity_test. go 2014-04-10 13:00:21 +0000 ensureavailabil ity_test. go 2014-04-22 12:28:07 +0000
=== modified file 'cmd/juju/
--- cmd/juju/
+++ cmd/juju/
@@ -114,14 +114,20 @@
}
func (s *EnsureAvailabi litySuite) TestEnsureAvail abilityErrors( c *gc.C) { bility( c) bility( c, "-n", fmt.Sprint(n)) bility( c, "-n", "3") bility( c, "-n", "3") bility( c, "-n", "1") litySuite) TestEnsureAvail abilityDefaults To3(c bility( c) AllMachines( )
- err := runEnsureAvaila
- c.Assert(err, gc.ErrorMatches, "must specify a number of state servers
odd and greater than zero")
for _, n := range []int{-1, 0, 2} {
err := runEnsureAvaila
c.Assert(err, gc.ErrorMatches, "must specify a number of state servers
odd and greater than zero")
}
- err = runEnsureAvaila
+ err := runEnsureAvaila
c.Assert(err, gc.IsNil)
err = runEnsureAvaila
c.Assert(err, gc.ErrorMatches, "cannot reduce state server count")
}
+
+func (s *EnsureAvailabi
*gc.C) {
+ err := runEnsureAvaila
+ c.Assert(err, gc.IsNil)
+ machines, err := s.State.
+ c.Assert(err, gc.IsNil)
+ c.Assert(machines, gc.HasLen, 3)
+}