Merge lp:~rogpeppe/juju-core/105-cloudinit-initial-password into lp:~juju/juju-core/trunk
| Status: | Merged |
|---|---|
| Approved by: | Gustavo Niemeyer on 2012-10-08 |
| Approved revision: | 635 |
| Merged at revision: | 628 |
| Proposed branch: | lp:~rogpeppe/juju-core/105-cloudinit-initial-password |
| Merge into: | lp:~juju/juju-core/trunk |
| Prerequisite: | lp:~rogpeppe/juju-core/107-jujud-bootstrap-initial-password |
| Diff against target: |
623 lines (+158/-68) 15 files modified
cmd/juju/ssh_test.go (+1/-1) cmd/juju/status_test.go (+2/-2) environs/cloudinit/cloudinit.go (+39/-18) environs/cloudinit/cloudinit_test.go (+63/-18) environs/dummy/environs.go (+3/-0) environs/ec2/ec2.go (+3/-1) environs/ec2/live_test.go (+8/-7) environs/ec2/local_test.go (+1/-0) environs/jujutest/livetests.go (+9/-8) environs/jujutest/test.go (+0/-7) environs/jujutest/tests.go (+3/-2) juju/testing/conn.go (+11/-0) worker/firewaller/firewaller_test.go (+9/-2) worker/provisioner/provisioner.go (+3/-1) worker/provisioner/provisioner_test.go (+3/-1) |
| To merge this branch: | bzr merge lp:~rogpeppe/juju-core/105-cloudinit-initial-password |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| The Go Language Gophers | 2012-10-05 | Pending | |
|
Review via email:
|
|||
Description of the Change
environs/cloudinit: use --initial-password
| Roger Peppe (rogpeppe) wrote : | # |
| Gustavo Niemeyer (niemeyer) wrote : | # |
One minor:
https:/
File environs/
https:/
environs/
Rather than ignoring it, we can make pretty good use of it.
Let's validate that when we're running bootstrap-state we've got an
empty EntityName, and when we're not running it, we've got one that
matches the entity name of the machine being started. If those fail, we
can error out and complain that the provider is mis-implemented.
| Roger Peppe (rogpeppe) wrote : | # |
https:/
File environs/
https:/
environs/
On 2012/10/05 15:43:41, niemeyer wrote:
> Rather than ignoring it, we can make pretty good use of it.
> Let's validate that when we're running bootstrap-state we've got an
empty
> EntityName, and when we're not running it, we've got one that matches
the entity
> name of the machine being started. If those fail, we can error out and
complain
> that the provider is mis-implemented.
ok. it's slightly strange that when running bootstrap-state, the
password is actually for the admin *and* the machine entity, but seems
reasonable. do you think it's ok to assume the machine entity name
format is well defined, or should we pass in a Machine here instead of a
machine id?
| Gustavo Niemeyer (niemeyer) wrote : | # |
https:/
File environs/
https:/
environs/
On 2012/10/05 16:40:12, rog wrote:
> On 2012/10/05 15:43:41, niemeyer wrote:
> > Rather than ignoring it, we can make pretty good use of it.
> >
> > Let's validate that when we're running bootstrap-state we've got an
empty
> > EntityName, and when we're not running it, we've got one that
matches the
> entity
> > name of the machine being started. If those fail, we can error out
and
> complain
> > that the provider is mis-implemented.
> ok. it's slightly strange that when running bootstrap-state, the
password is
> actually for the admin *and* the machine entity, but seems reasonable.
do you
> think it's ok to assume the machine entity name format is well
defined, or
> should we pass in a Machine here instead of a machine id?
if cfg.EntityName != "machine-" + strconv.
return fmt.Errorf("invalid machine configuration: need
authentication for machine %d", cfg.MachineId)
}
Let's not spend too much time on something that trivial.
| Roger Peppe (rogpeppe) wrote : | # |
Please take a look.
| Roger Peppe (rogpeppe) wrote : | # |
Please take a look.
| Roger Peppe (rogpeppe) wrote : | # |
https:/
File environs/
https:/
environs/
On 2012/10/05 17:13:04, niemeyer wrote:
> On 2012/10/05 16:40:12, rog wrote:
> > On 2012/10/05 15:43:41, niemeyer wrote:
> > > Rather than ignoring it, we can make pretty good use of it.
> > >
> > > Let's validate that when we're running bootstrap-state we've got
an empty
> > > EntityName, and when we're not running it, we've got one that
matches the
> > entity
> > > name of the machine being started. If those fail, we can error out
and
> > complain
> > > that the provider is mis-implemented.
> >
> > ok. it's slightly strange that when running bootstrap-state, the
password is
> > actually for the admin *and* the machine entity, but seems
reasonable. do you
> > think it's ok to assume the machine entity name format is well
defined, or
> > should we pass in a Machine here instead of a machine id?
> if cfg.EntityName != "machine-" + strconv.
> return fmt.Errorf("invalid machine configuration: need
authentication for
> machine %d", cfg.MachineId)
> }
> Let's not spend too much time on something that trivial.
Done.
| Gustavo Niemeyer (niemeyer) wrote : | # |
LGTM
https:/
File environs/
https:/
environs/
machineId),
Password: "unimportant",
| Roger Peppe (rogpeppe) wrote : | # |
Please take a look.
| Roger Peppe (rogpeppe) wrote : | # |
Please take a look.
https:/
File environs/
https:/
environs/
machineId),
On 2012/10/05 17:39:18, niemeyer wrote:
> Password: "unimportant",
Done. But I've moved this function into juju/testing, because it's
useful elsewhere now.
| Gustavo Niemeyer (niemeyer) wrote : | # |
LGTM
https:/
File juju/testing/
https:/
juju/testing/
Please reindent.
- 634. By Roger Peppe on 2012-10-08
-
merge trunk
- 635. By Roger Peppe on 2012-10-08
-
environs/jujutest: fix InvalidStateInfo reference
| Roger Peppe (rogpeppe) wrote : | # |
Please take a look.
| Roger Peppe (rogpeppe) wrote : | # |
*** Submitted:
environs/cloudinit: use --initial-password
R=TheMue, niemeyer
CC=
https:/


Reviewers: mp+128222_ code.launchpad. net,
Message:
Please take a look.
Description:
environs/cloudinit: use --initial-password
https:/ /code.launchpad .net/~rogpeppe/ juju-core/ 105-cloudinit- initial- password/ +merge/ 128222
Requires: /code.launchpad .net/~rogpeppe/ juju-core/ 107-jujud- bootstrap- initial- password/ +merge/ 128210
https:/
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6612054/
Affected files: cloudinit/ cloudinit. go cloudinit/ cloudinit_ test.go
A [revision details]
M environs/
M environs/
M environs/ec2/ec2.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: <email address hidden>
+New revision: <email address hidden>
Index: environs/ cloudinit/ cloudinit. go cloudinit/ cloudinit. go' cloudinit/ cloudinit. go 2012-10-05 10:17:49 +0000 cloudinit/ cloudinit. go 2012-10-05 10:48:47 +0000
=== modified file 'environs/
--- environs/
+++ environs/
@@ -38,6 +38,7 @@
// StateInfo holds the means for the new instance to communicate with the
// juju state. Unless the new machine is running a state server
(StateServer is
// set), there must be at least one state server address supplied.
+ // The entity name will be ignored.
StateInfo *state.Info
// Tools is juju tools to be used on the new machine. dAccessor+ base64yaml( cfg.Config) )+ +mgoPortSuffix+ cfg.StateInfo. Password) +
@@ -127,6 +128,7 @@
" --instance-id "+cfg.InstanceI
" --env-config "+shquote(
" --state-servers localhost"
+ " --initial-password "+shquote(
debugFlag,
)
@@ -158,11 +160,13 @@ juju/%s- agent.log" + zookeeperHostAd drs(), Password, "tools URL") "state info") ccessor == "" { "instance id accessor") "environment configuration") StateInfo. Addrs) == 0 { "zookeeper hosts") StateInfo. Addrs) == 0 { "state hosts") Password {
" --state-servers '%s'"+
" --log-file /var/log/
" --data-dir '%s'"+
+ " --initial-password '%s'"+
" %s",
toolsDir, kind,
cfg.
name,
cfg.DataDir,
+ cfg.StateInfo.
args,
)
conf := &upstart.Conf{
@@ -252,6 +256,9 @@
if cfg.Tools.URL == "" {
return requiresError(
}
+ if cfg.StateInfo == nil {
+ return requiresError(
+ }
if cfg.StateServer {
if cfg.InstanceIdA
return requiresError(
@@ -260,8 +267,13 @@
return requiresError(
}
} else {
- if cfg.StateInfo == nil || len(cfg.
- return requiresError(
+ if len(cfg.
+ return requiresError(
+ }
+ }
+ for _, r := range cfg.StateInfo.
+ if r == '\'' || r == '\\' || r < 32 {
+ return fmt.Errorf("invalid machine configuration: password has
disallowed characters")
}
}
return nil
Index: environs/ cloudinit/ cloudinit_ test.go cloudinit/ cloudinit_ test.go' cloudinit/ cloudinit_ test.go 2012-09-28 13:17:11 +0000 cloudinit/ cloudinit_ test.go 2012-10-05 09:37:03 +0000 "1.2.3- linux-amd64" ),
=== modified file 'environs/
--- environs/
+++ environs/
@@ -43,8 +43,11 @@
AuthorizedKeys: "sshkey1",
Tools: newSimpleTools(
StateServer:...