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

Issue 7327050: state: Machine.InstanceId returns bool

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by rog
Modified:
11 years, 2 months ago
Reviewers:
mp+149097, dave, jameinel, dimitern
Visibility:
Public.

Description

state: Machine.InstanceId returns bool It brings it into line with other similar accessors. https://code.launchpad.net/~rogpeppe/juju-core/221-instanceid-bool/+merge/149097 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: Machine.InstanceId returns bool #

Total comments: 14

Patch Set 3 : state: Machine.InstanceId returns bool #

Unified diffs Side-by-side diffs Delta from patch set Stats (+83 lines, -100 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/ssh.go View 1 2 2 chunks +4 lines, -2 lines 0 comments Download
M cmd/juju/ssh_test.go View 1 chunk +2 lines, -2 lines 0 comments Download
M cmd/juju/status.go View 1 chunk +2 lines, -4 lines 0 comments Download
M cmd/jujud/bootstrap_test.go View 1 chunk +2 lines, -2 lines 0 comments Download
M cmd/jujud/machine_test.go View 1 2 2 chunks +4 lines, -7 lines 0 comments Download
M environs/jujutest/livetests.go View 4 chunks +9 lines, -10 lines 0 comments Download
M state/api/api_test.go View 1 2 4 chunks +16 lines, -16 lines 0 comments Download
M state/api/apiclient.go View 1 2 1 chunk +4 lines, -6 lines 0 comments Download
M state/machine.go View 1 chunk +4 lines, -6 lines 0 comments Download
M state/machine_test.go View 3 chunks +8 lines, -9 lines 0 comments Download
M state/state_test.go View 2 chunks +4 lines, -4 lines 0 comments Download
M worker/firewaller/firewaller.go View 1 2 2 chunks +8 lines, -6 lines 0 comments Download
M worker/provisioner/provisioner.go View 3 chunks +6 lines, -15 lines 0 comments Download
M worker/provisioner/provisioner_test.go View 1 2 1 chunk +8 lines, -11 lines 0 comments Download

Messages

Total messages: 6
rog
Please take a look.
11 years, 2 months ago (2013-02-18 16:38:26 UTC) #1
dave_cheney.net
LGTM. Thank you. https://codereview.appspot.com/7327050/diff/2001/cmd/juju/ssh.go File cmd/juju/ssh.go (right): https://codereview.appspot.com/7327050/diff/2001/cmd/juju/ssh.go#newcode98 cmd/juju/ssh.go:98: instid, ok := machine.InstanceId() if instid, ...
11 years, 2 months ago (2013-02-18 22:29:55 UTC) #2
jameinel
I think the specific of returning a bool to indicate "string is not empty" is ...
11 years, 2 months ago (2013-02-19 10:50:02 UTC) #3
dimitern
LGTM, and I agree with dfc's suggestions.
11 years, 2 months ago (2013-02-19 10:58:08 UTC) #4
dave_cheney.net
I think the argument here is the document is already in memory, so any error ...
11 years, 2 months ago (2013-02-19 11:16:09 UTC) #5
rog
11 years, 2 months ago (2013-02-19 11:30:47 UTC) #6
*** Submitted:

state: Machine.InstanceId returns bool

It brings it into line with other similar accessors.

R=dfc, jameinel, dimitern
CC=
https://codereview.appspot.com/7327050

https://codereview.appspot.com/7327050/diff/2001/cmd/juju/ssh.go
File cmd/juju/ssh.go (right):

https://codereview.appspot.com/7327050/diff/2001/cmd/juju/ssh.go#newcode98
cmd/juju/ssh.go:98: instid, ok := machine.InstanceId()
On 2013/02/18 22:29:55, dfc wrote:
> if instid, ok := ... ; ok { 
>    ...
> }
> 
> Sorry, this was my mistake initially

done, but i consider it a matter of taste rather than a mistake. i'm happy with
both forms.

i've left you with a note about the real bug in this loop which, to be fair, you
may well not have been responsible for :-)

https://codereview.appspot.com/7327050/diff/2001/cmd/juju/status.go
File cmd/juju/status.go (right):

https://codereview.appspot.com/7327050/diff/2001/cmd/juju/status.go#newcode120
cmd/juju/status.go:120: instid, ok := m.InstanceId()
On 2013/02/18 22:29:55, dfc wrote:
> same

i'll leave this as is actually - the slightly less dense code is more readable
IMHO.

https://codereview.appspot.com/7327050/diff/2001/cmd/jujud/machine_test.go
File cmd/jujud/machine_test.go (right):

https://codereview.appspot.com/7327050/diff/2001/cmd/jujud/machine_test.go#ne...
cmd/jujud/machine_test.go:172: _, ok := m1.InstanceId()
On 2013/02/18 22:29:55, dfc wrote:
> if _, ok := ... ; ok {
>    continue
> }

done, slightly differently.

https://codereview.appspot.com/7327050/diff/2001/state/api/apiclient.go
File state/api/apiclient.go (right):

https://codereview.appspot.com/7327050/diff/2001/state/api/apiclient.go#newco...
state/api/apiclient.go:121: // InstanceId returns the provider specific instance
id for this machine.
On 2013/02/18 22:29:55, dfc wrote:
> Please update the comment to match state.Machine.InstanceId()

Done.

https://codereview.appspot.com/7327050/diff/2001/worker/firewaller/firewaller.go
File worker/firewaller/firewaller.go (right):

https://codereview.appspot.com/7327050/diff/2001/worker/firewaller/firewaller...
worker/firewaller/firewaller.go:268: if !ok {
On 2013/02/18 22:29:55, dfc wrote:
> Should this use state.NotFoundf ? 

it can't yet, as that CL is dependent on this one. will change subsequently.
added a TODO.

https://codereview.appspot.com/7327050/diff/2001/worker/firewaller/firewaller...
worker/firewaller/firewaller.go:441: if !ok {
On 2013/02/18 22:29:55, dfc wrote:
> same

same

https://codereview.appspot.com/7327050/diff/2001/worker/provisioner/provision...
File worker/provisioner/provisioner_test.go (right):

https://codereview.appspot.com/7327050/diff/2001/worker/provisioner/provision...
worker/provisioner/provisioner_test.go:161: _, ok := m.InstanceId()
On 2013/02/18 22:29:55, dfc wrote:
> if _, ok := ... ; !ok {
>   ...
> }

done, slightly differently.
Sign in to reply to this message.

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