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

Issue 8348043: Refactoring environ mongo functions and version.

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

Description

Refactoring environ mongo functions and version. This branch started as one to move the Mongo tool selection functions out of environs/tools.go and into their own file. I also changed the parameters to be only what the function actually needed. This made the call-sites simpler too. Then I added a few more helper functions to the versions package, and started using them in locations in the code. Too many places were using version.Current when what they actually wanted was a string representation of the version number, or the default series. Additional methods were added for CurrentSeries, and CurrentArch, so they could be exposed independently of version.Current. A DefaultSeries method is added to express the intent that by default we support precise, and have this different to version.Current, or version.CurrentSeries, which represents the current machine that the code is running on. Putting fake tools was modified in dummy to put both the current series, and the default series if it is different to the current series. Same for the other putFakeTools functions that were used by ec2 and openstack. That method was extracted into a common testing package, but had to be in a new package as there were circular dependencies trying to use the main testing module due to internal test in environs. https://code.launchpad.net/~thumper/juju-core/mongo-driveby/+merge/156992 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 20

Patch Set 2 : Refactoring environ mongo functions and version. #

Total comments: 3

Patch Set 3 : Refactoring environ mongo functions and version. #

Total comments: 1

Patch Set 4 : Refactoring environ mongo functions and version. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+281 lines, -228 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/sync_tools_test.go View 1 2 3 6 chunks +40 lines, -37 lines 0 comments Download
M environs/config/config.go View 1 2 4 chunks +6 lines, -3 lines 0 comments Download
M environs/config/config_test.go View 1 2 4 chunks +4 lines, -4 lines 0 comments Download
M environs/dummy/environs.go View 1 2 1 chunk +10 lines, -1 line 0 comments Download
M environs/ec2/ec2.go View 1 chunk +1 line, -4 lines 0 comments Download
M environs/ec2/live_test.go View 1 2 3 chunks +4 lines, -3 lines 0 comments Download
M environs/ec2/local_test.go View 1 2 3 chunks +4 lines, -16 lines 0 comments Download
M environs/jujutest/livetests.go View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
A environs/mongo.go View 1 1 chunk +48 lines, -0 lines 0 comments Download
A environs/mongo_test.go View 1 chunk +87 lines, -0 lines 0 comments Download
M environs/openstack/live_test.go View 3 chunks +2 lines, -15 lines 0 comments Download
M environs/openstack/local_test.go View 2 chunks +2 lines, -1 line 0 comments Download
M environs/openstack/provider.go View 1 chunk +1 line, -4 lines 0 comments Download
A environs/testing/tools.go View 1 2 1 chunk +29 lines, -0 lines 0 comments Download
M environs/tools.go View 2 chunks +0 lines, -42 lines 0 comments Download
M environs/tools_test.go View 1 5 chunks +7 lines, -77 lines 0 comments Download
M juju/testing/conn.go View 1 2 2 chunks +1 line, -2 lines 0 comments Download
M version/current_test.go View 1 chunk +1 line, -1 line 0 comments Download
M version/version.go View 1 1 chunk +18 lines, -3 lines 0 comments Download
M worker/provisioner/provisioner_test.go View 1 2 13 chunks +13 lines, -14 lines 0 comments Download

Messages

Total messages: 13
thumper
Please take a look.
11 years ago (2013-04-03 22:36:16 UTC) #1
fwereade
The core of this is great but I have a bunch of questions and suggestions: ...
11 years ago (2013-04-03 22:56:03 UTC) #2
thumper
https://codereview.appspot.com/8348043/diff/1/environs/config/config_test.go File environs/config/config_test.go (right): https://codereview.appspot.com/8348043/diff/1/environs/config/config_test.go#newcode522 environs/config/config_test.go:522: On 2013/04/03 22:56:04, fwereade wrote: > Surely, drop default-series ...
11 years ago (2013-04-04 01:04:37 UTC) #3
thumper
Please take a look.
11 years ago (2013-04-04 01:07:39 UTC) #4
fwereade
LGTM, this is a clear improvement. Thanks. https://codereview.appspot.com/8348043/diff/17001/environs/ec2/ec2.go File environs/ec2/ec2.go (right): https://codereview.appspot.com/8348043/diff/17001/environs/ec2/ec2.go#newcode288 environs/ec2/ec2.go:288: mongoURL := ...
11 years ago (2013-04-04 07:02:24 UTC) #5
dfc
Didn't read the whole thing. I couldn't find the definition of version.CurrentNumber. https://codereview.appspot.com/8348043/diff/17001/environs/config/config.go File environs/config/config.go ...
11 years ago (2013-04-04 07:14:43 UTC) #6
thumper
https://codereview.appspot.com/8348043/diff/17001/environs/ec2/ec2.go File environs/ec2/ec2.go (right): https://codereview.appspot.com/8348043/diff/17001/environs/ec2/ec2.go#newcode288 environs/ec2/ec2.go:288: mongoURL := environs.MongoURL(e, tools.Series, tools.Arch) On 2013/04/04 07:02:25, fwereade ...
11 years ago (2013-04-04 07:43:52 UTC) #7
thumper
On 2013/04/04 07:14:43, dfc wrote: > Didn't read the whole thing. I couldn't find the ...
11 years ago (2013-04-04 07:44:31 UTC) #8
dfc
>> Why not make this a constant ? > > > Because then it wouldn't ...
11 years ago (2013-04-04 07:46:43 UTC) #9
thumper
Please take a look.
11 years ago (2013-04-04 08:51:56 UTC) #10
dfc
LGTM. Thank you. https://codereview.appspot.com/8348043/diff/16002/version/version.go File version/version.go (right): https://codereview.appspot.com/8348043/diff/16002/version/version.go#newcode43 version/version.go:43: Arch: CurrentArch(), sooo much better!
11 years ago (2013-04-04 08:57:22 UTC) #11
thumper
*** Submitted: Refactoring environ mongo functions and version. This branch started as one to move ...
11 years ago (2013-04-04 09:40:12 UTC) #12
rog
10 years, 7 months ago (2013-09-20 17:45:54 UTC) #13
On 2013/04/04 09:40:12, thumper wrote:
> Additional methods were added for
> CurrentSeries, and CurrentArch, so they could be exposed independently of
> version.Current.

Does anyone remember why this was considered a good thing?

Having two sources of truth for the current series seems
potentially risky - I saw a test problem reported recently building
under Saucy that I think might be caused by this, though
I can't be sure.
Sign in to reply to this message.

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