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

Issue 11424044: api: Use MachineNonce when opening API as MA (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by dimitern
Modified:
10 years, 9 months ago
Reviewers:
mp+175791, fwereade, rog
Visibility:
Public.

Description

api: Use MachineNonce when opening API as MA This introduces an extra field in api.Info: MachineNonce, which needs to be set when opening/logging in into the API server as a machine agent (ignored in other cases). The server ensures the connecting machine agents won't operate on a wrong or unprovisioned machine (in the latter case they shouldn't run anyway and now they stop immediately after starting). Added tests for the behavior in apiserver. It might seem there are a lot of changes, but that's because it touches one of the basic types api.Info and how API connections are established. These changes will be followed up by another branch which starts and stops a pinger at the apiserver automatically when a machine agent connects successfully, so that we can get rid of SetAgentAlive eventually. https://code.launchpad.net/~dimitern/juju-core/072-machineagent-login-nonce/+merge/175791 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 13

Patch Set 2 : api: Use MachineNonce when opening API as MA #

Total comments: 6

Patch Set 3 : api: Use MachineNonce when opening API as MA #

Unified diffs Side-by-side diffs Delta from patch set Stats (+123 lines, -19 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M agent/agent.go View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M cmd/jujud/agent.go View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M cmd/jujud/machine_test.go View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M juju/testing/conn.go View 1 2 1 chunk +14 lines, -3 lines 0 comments Download
M state/api/apiclient.go View 1 2 2 chunks +5 lines, -1 line 0 comments Download
M state/api/deployer/deployer_test.go View 1 chunk +3 lines, -1 line 0 comments Download
M state/api/machineagent/state_test.go View 1 chunk +3 lines, -1 line 0 comments Download
M state/api/machiner/machiner_test.go View 1 chunk +4 lines, -1 line 0 comments Download
M state/api/params/apierror.go View 1 chunk +1 line, -0 lines 0 comments Download
M state/api/params/params.go View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M state/api/state.go View 1 2 1 chunk +5 lines, -3 lines 0 comments Download
M state/api/upgrader/upgrader_test.go View 1 chunk +3 lines, -1 line 0 comments Download
M state/api/watcher/watcher_test.go View 1 1 chunk +3 lines, -1 line 0 comments Download
M state/apiserver/admin.go View 1 2 1 chunk +11 lines, -2 lines 0 comments Download
M state/apiserver/client/api_test.go View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M state/apiserver/common/errors.go View 2 chunks +2 lines, -0 lines 0 comments Download
M state/apiserver/errors_test.go View 1 chunk +3 lines, -0 lines 0 comments Download
M state/apiserver/login_test.go View 1 chunk +2 lines, -1 line 0 comments Download
M state/apiserver/pinger_test.go View 2 chunks +3 lines, -1 line 0 comments Download
M state/apiserver/server_test.go View 1 2 3 chunks +50 lines, -2 lines 0 comments Download

Messages

Total messages: 7
dimitern
Please take a look.
10 years, 9 months ago (2013-07-19 10:16:04 UTC) #1
rog
LGTM with a few suggestions below https://codereview.appspot.com/11424044/diff/1/agent/agent.go File agent/agent.go (right): https://codereview.appspot.com/11424044/diff/1/agent/agent.go#newcode214 agent/agent.go:214: if c.MachineNonce != ...
10 years, 9 months ago (2013-07-19 11:20:29 UTC) #2
dimitern
Please take a look. https://codereview.appspot.com/11424044/diff/1/agent/agent.go File agent/agent.go (right): https://codereview.appspot.com/11424044/diff/1/agent/agent.go#newcode214 agent/agent.go:214: if c.MachineNonce != "" && ...
10 years, 9 months ago (2013-07-19 13:33:07 UTC) #3
rog
https://codereview.appspot.com/11424044/diff/1/state/apiserver/pinger_test.go File state/apiserver/pinger_test.go (right): https://codereview.appspot.com/11424044/diff/1/state/apiserver/pinger_test.go#newcode36 state/apiserver/pinger_test.go:36: st := s.OpenAPIAsMachine(c, stm.Tag(), "password", "fake_nonce") On 2013/07/19 13:33:08, ...
10 years, 9 months ago (2013-07-19 14:01:16 UTC) #4
dimitern
On 2013/07/19 14:01:16, rog wrote: > https://codereview.appspot.com/11424044/diff/1/state/apiserver/pinger_test.go > File state/apiserver/pinger_test.go (right): > > https://codereview.appspot.com/11424044/diff/1/state/apiserver/pinger_test.go#newcode36 > ...
10 years, 9 months ago (2013-07-19 14:11:34 UTC) #5
fwereade
LGTM in principle, with a couple of vague thoughts (below) and one more suggestion: how ...
10 years, 9 months ago (2013-07-19 16:25:03 UTC) #6
dimitern
10 years, 9 months ago (2013-07-19 17:21:13 UTC) #7
Please take a look.

https://codereview.appspot.com/11424044/diff/9001/cmd/jujud/agent.go
File cmd/jujud/agent.go (right):

https://codereview.appspot.com/11424044/diff/9001/cmd/jujud/agent.go#newcode111
cmd/jujud/agent.go:111: isUpgraded(err) {
On 2013/07/19 16:25:03, fwereade wrote:
> This is a bit weirdly formatted. Might look nicer expanded a little bit into a
> switch or if/else if/else if? YMMV

Done.

https://codereview.appspot.com/11424044/diff/9001/environs/cloudinit/cloudini...
File environs/cloudinit/cloudinit_test.go (right):

https://codereview.appspot.com/11424044/diff/9001/environs/cloudinit/cloudini...
environs/cloudinit/cloudinit_test.go:151: echo 'datadir:
/var/lib/juju\\nstateservercert:\\n[^']+stateserverkey:\\n[^']+stateport:
37017\\napiport: 17070\\noldpassword: arble\\nmachinenonce:
FAKE_NONCE\\nstateinfo:\\n  addrs:\\n  - localhost:37017\\n  cacert:\\n[^']+ 
tag: machine-0\\n  password: ""\\noldapipassword: ""\\napiinfo:\\n  addrs:\\n  -
localhost:17070\\n  cacert:\\n[^']+  tag: machine-0\\n  password: ""\\n 
machinenonce: ""\\n' > '/var/lib/juju/agents/machine-0/agent\.conf'
On 2013/07/19 16:25:03, fwereade wrote:
> This doesn't look right. Is anything using the nonce apart from the api info
> now?
> 
> ...oh blast. Compatibility. Carry on :).
> 
> But maybe we should put it directly into the api info all the same, even if we
> can't drop it from the top level?

It is in the APIInfo. And the top-level is needed by the provisioner . Once it's
using only the API I guess we can remove it from top-level.
Sign in to reply to this message.

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