https://codereview.appspot.com/9614043/diff/1/state/api/apiclient.go#newcode352
state/api/apiclient.go:352: // a HasAssignedUnitsError.
i think you need a new error code for this.
you'll need to add a new code (say CodeHasAssignedUnits) to the error
codes in api/error.go, and add some code to translate from
*state.HasAssignUnitsError to CodeHasAssignedUnits in
apiserver.serverError.
plus an associated test and changing the comment above appropriately.
LGTM with the error code fix and some other minor suggestions.
https:/ /codereview. appspot. com/9614043/ diff/1/ state/api/ apiclient. go apiclient. go (right):
File state/api/
https:/ /codereview. appspot. com/9614043/ diff/1/ state/api/ apiclient. go#newcode352 apiclient. go:352: // a HasAssignedUnit sError. Units) to the error HasAssignUnitsE rror to CodeHasAssigned Units in serverError.
state/api/
i think you need a new error code for this.
you'll need to add a new code (say CodeHasAssigned
codes in api/error.go, and add some code to translate from
*state.
apiserver.
plus an associated test and changing the comment above appropriately.
https:/ /codereview. appspot. com/9614043/ diff/1/ state/api/ apiclient. go#newcode370 apiclient. go:370: type Pinger struct {
state/api/
doc comment please.
https:/ /codereview. appspot. com/9614043/ diff/1/ state/api/ apiclient. go#newcode375 apiclient. go:375: func (p *Pinger) Stop() error {
state/api/
ditto
https:/ /codereview. appspot. com/9614043/ diff/1/ state/api/ params/ params. go params/ params. go (right):
File state/api/
https:/ /codereview. appspot. com/9614043/ diff/1/ state/api/ params/ params. go#newcode32 params/ params. go:32: // SetStatus holds the parameters for
state/api/
making the SetStatus call for a machine or unit.
// SetStatus holds the parameters for Machine.SetStatus
// and Unit.SetStatus.
?
https:/ /codereview. appspot. com/9614043/ diff/1/ state/api/ params/ params. go#newcode352 params/ params. go:352: Life string
state/api/
please change this to be of type Life.
https:/ /codereview. appspot. com/9614043/ diff/1/ state/apiserver /api_test. go /api_test. go (right):
File state/apiserver
https:/ /codereview. appspot. com/9614043/ diff/1/ state/apiserver /api_test. go#newcode77 /api_test. go:77: // 1, because it's managing the
state/apiserver
environment.
// Machine 0 is allowed because it is an environment manager.
?
https:/ /codereview. appspot. com/9614043/ diff/1/ state/apiserver /api_test. go#newcode90 /api_test. go:90: // Machine 0 needs to set the status of
state/apiserver
a machine when provisioning.
ditto?
https:/ /codereview. appspot. com/9614043/ diff/1/ state/apiserver /api_test. go#newcode287 /api_test. go:287: }
state/apiserver
you can stop the pinger here (and you should check the error return too)
https:/ /codereview. appspot. com/9614043/ diff/1/ state/apiserver /api_test. go#newcode320 /api_test. go:320: setDefaultStatus(c, m)
state/apiserver
rather than setting a default status here, i think you should find out
the previous status and set it back.
you should also check the error when doing so.
that way you won't need to call setDefaultStatus in setupScenario, which
is then free to add other machines with different statuses if necessary.
https:/ /codereview. appspot. com/9614043/ diff/1/ state/apiserver /api_test. go#newcode692 /api_test. go:692: func setDefaultStatus(c *C, entity
state/apiserver
setStatuser) {
as implied above, i don't think this is necessary.
https:/ /codereview. appspot. com/9614043/ diff/1/ state/apiserver /apiserver. go /apiserver. go (right):
File state/apiserver
https:/ /codereview. appspot. com/9614043/ diff/1/ state/apiserver /apiserver. go#newcode246 /apiserver. go:246: // authOwner returns true only if the
state/apiserver
authenticated user's tag
// authOwner returns whether the authenticated user's tag
// matches the given entity's tag.
https:/ /codereview. appspot. com/9614043/ diff/1/ state/apiserver /apiserver. go#newcode253 /apiserver. go:253: // authEnvironManager returns true
state/apiserver
only if the authenticated user is
// authEnvironManager returns whether the authenticated
// user is a machine with running the ManageEnviron job.
https:/ /codereview. appspot. com/9614043/