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

Issue 14486043: state: Add SetEnvironAgentVersion (Closed)

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

Description

state: Add SetEnvironAgentVersion Implemented a SetEnvironAgentVersion state call, which: 1. Ensures the current environment has a valid agent-version; 2. Finds all machines and units in state that have an empty or different tools version; 3. Changes the agent-version in the environment, asserting it haven't changed in the mean time. This is a prerequisite step to changing upgrage-juju command to default to major.minor+2 steps, unless forced with --version. https://code.launchpad.net/~dimitern/juju-core/160-setenvironagentversion/+merge/189570 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: Add SetEnvironAgentVersion #

Total comments: 38

Patch Set 3 : state: Add SetEnvironAgentVersion #

Total comments: 10

Patch Set 4 : state: Add SetEnvironAgentVersion #

Total comments: 10

Patch Set 5 : state: Add SetEnvironAgentVersion #

Total comments: 6

Patch Set 6 : state: Add SetEnvironAgentVersion #

Unified diffs Side-by-side diffs Delta from patch set Stats (+271 lines, -0 lines) Patch
A [revision details] View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M state/state.go View 1 2 3 4 5 3 chunks +104 lines, -0 lines 0 comments Download
M state/state_test.go View 1 2 3 4 5 1 chunk +165 lines, -0 lines 0 comments Download

Messages

Total messages: 16
dimitern
Please take a look.
10 years, 7 months ago (2013-10-07 11:04:13 UTC) #1
dimitern
Please take a look.
10 years, 7 months ago (2013-10-07 11:06:32 UTC) #2
rog
Looking good; some thoughts and suggestions below. https://codereview.appspot.com/14486043/diff/6001/state/state.go File state/state.go (right): https://codereview.appspot.com/14486043/diff/6001/state/state.go#newcode147 state/state.go:147: machines map[string]version.Number ...
10 years, 7 months ago (2013-10-07 12:28:55 UTC) #3
fwereade
Few thoughts, general agreement with rog https://codereview.appspot.com/14486043/diff/6001/state/state.go File state/state.go (right): https://codereview.appspot.com/14486043/diff/6001/state/state.go#newcode172 state/state.go:172: return fmt.Sprintf("%s units ...
10 years, 7 months ago (2013-10-07 13:03:58 UTC) #4
rog
https://codereview.appspot.com/14486043/diff/6001/state/state.go File state/state.go (right): https://codereview.appspot.com/14486043/diff/6001/state/state.go#newcode214 state/state.go:214: {{"tools.version", D{{"$not", bson.RegEx{matchVersion, "i"}}}}}, On 2013/10/07 13:03:58, fwereade wrote: ...
10 years, 7 months ago (2013-10-07 13:15:02 UTC) #5
fwereade
On 2013/10/07 13:15:02, rog wrote: > On 2013/10/07 13:03:58, fwereade wrote: > > Heh. It ...
10 years, 7 months ago (2013-10-08 08:21:37 UTC) #6
dimitern
Please take a look. https://codereview.appspot.com/14486043/diff/6001/state/state.go File state/state.go (right): https://codereview.appspot.com/14486043/diff/6001/state/state.go#newcode147 state/state.go:147: machines map[string]version.Number On 2013/10/07 12:28:55, ...
10 years, 7 months ago (2013-10-08 10:40:13 UTC) #7
rog
LGTM module the below minor points. Is there some way of checking transaction behaviour now ...
10 years, 7 months ago (2013-10-08 12:42:26 UTC) #8
rog
On 2013/10/08 12:42:26, rog wrote: > LGTM module the below minor points. s/module/modulo/
10 years, 7 months ago (2013-10-08 12:42:49 UTC) #9
fwereade
Couple more thoughts https://codereview.appspot.com/14486043/diff/6001/state/state.go File state/state.go (right): https://codereview.appspot.com/14486043/diff/6001/state/state.go#newcode153 state/state.go:153: items := make([]string, len(m)) On 2013/10/08 ...
10 years, 7 months ago (2013-10-08 12:44:58 UTC) #10
fwereade
On 2013/10/08 12:42:26, rog wrote: > LGTM module the below minor points. > > Is ...
10 years, 7 months ago (2013-10-08 12:45:55 UTC) #11
dimitern
Please take a look. https://codereview.appspot.com/14486043/diff/6001/state/state.go File state/state.go (right): https://codereview.appspot.com/14486043/diff/6001/state/state.go#newcode153 state/state.go:153: items := make([]string, len(m)) On ...
10 years, 7 months ago (2013-10-08 14:38:57 UTC) #12
fwereade
Coming along nicely, but I think there are some subtleties... https://codereview.appspot.com/14486043/diff/25001/state/state.go File state/state.go (right): https://codereview.appspot.com/14486043/diff/25001/state/state.go#newcode163 ...
10 years, 7 months ago (2013-10-08 14:50:40 UTC) #13
dimitern
Please take a look. https://codereview.appspot.com/14486043/diff/25001/state/state.go File state/state.go (right): https://codereview.appspot.com/14486043/diff/25001/state/state.go#newcode163 state/state.go:163: func IsVersionInconsistentError(e interface{}) bool { ...
10 years, 7 months ago (2013-10-08 15:03:31 UTC) #14
fwereade
LGTM modulo details of exactly how the code's arranged. Thanks. https://codereview.appspot.com/14486043/diff/16001/state/state.go File state/state.go (right): https://codereview.appspot.com/14486043/diff/16001/state/state.go#newcode226 ...
10 years, 7 months ago (2013-10-08 15:50:07 UTC) #15
dimitern
10 years, 7 months ago (2013-10-09 07:44:06 UTC) #16
Please take a look.

https://codereview.appspot.com/14486043/diff/16001/state/state.go
File state/state.go (right):

https://codereview.appspot.com/14486043/diff/16001/state/state.go#newcode226
state/state.go:226: if err == nil && currentVersion == "" {
On 2013/10/08 15:50:08, fwereade wrote:
> This is a little bit opaque, you might be better served by just poking
> getCurrentAgentVersion into this func directly now that there's just one
client
> (plus, I don't like that name (given what it does) and can't think of a good
one
> ;)).

Done.

https://codereview.appspot.com/14486043/diff/16001/state/state.go#newcode239
state/state.go:239: }
On 2013/10/08 15:50:08, fwereade wrote:
> This block might make sense rolled into something like
> 
> if err := st.checkCanUpgrade(cur,new); err != nil {
>     return err
> }
> 
> ? seems like a bit more of a cohesive operation than
> getAgentTagsNotMatchingVersion...

Done.

https://codereview.appspot.com/14486043/diff/16001/state/state_test.go
File state/state_test.go (right):

https://codereview.appspot.com/14486043/diff/16001/state/state_test.go#newcod...
state/state_test.go:2010: checker.Check()
On 2013/10/08 15:50:08, fwereade wrote:
> Would be great to split this func into several for the various cases you're
> testing -- they seem basically independent, right?

I wanted to reuse the setup code - that's what they share, but I guess with a
few helpers it'll split nicely in smaller tests.
Sign in to reply to this message.

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