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

Issue 8663045: upgrade-juju: improvements

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years ago by fwereade
Modified:
11 years ago
Reviewers:
dimitern, mp+158596, thumper
Visibility:
Public.

Description

upgrade-juju: improvements So, this started out as a quick branch to fix the versioning-related tests in light of the change to dev versions. Quite a lot of the changes were mechanical, by jujud.Upgrader and UpgradeJujuCommand demanded quite a lot of careful thought and additional test coverage. It should be noted that the dev versioning change made here is somewhat cautious: it makes developiness contingent on (1) minor version oddity and (2) build version existence. This is open to further discussion, and it will be much easier to deal with further changes once this branch has landed. The end result of my attempts to fix the various broken and/or untested bits of the command was a rewritten command, with the following consequences within the cmd/juju package. * bootstrap now accepts --series instead of --fake-series. * upgrade-juju also accepts --series. * --series is only valid when used with --upload-tools on either command; in each case, it clones the tools built for the host series such that they are uploaded as the tools for all supplied series. * when --series is omitted, --upload-tools will assume that tools should be cloned for any of the following that are not the host series: * precise (config.DefaultSeries), for which most charms are written; * environment default-series, on which env machines will run. * --upload-tools now forces the reported number of the built tools to be the same as the current CLI tools (plus a build number); this is wrong, in general, but it's consistently and mostly harmlessly so. * if a --version param is passed to upgrade-juju --upload-tools, it instead builds the current source and forces its reported number to match the supplied version (plus unique build number) instead of the CLI version. * upgrade-juju no longer accepts --bump-version; as described above, versions are now just bumped when they need to be. * upgrade-juju now communicates problems rather more helpfully I think. The main implementation difference is that the detailed upgrade selection logic is now centered on a separate type (which is somewhat badly named -- upgradeVersions). The command object's fields are now left unchanged from their values at the end of Init, and Run-specific state is now held within that method's scope. One of the details of the implementation difference is that this is the second place to use the tools.List style access and manipulation, exposed via the new environs.FindAvailableTools func; branches to use it at provisioning time and elsewhere should follow quickly. The other drive-by changes are as follows: * version.Zero is slightly nicer than version.Number{}. Wish I could make it const though :/. * tools.List has a new URLs method that returns its content as a map. * tools.Newest now also returns the version number shared by the tools in the original result. * tests that got tweaked were frequently also reformatted for indentation and vertical density. * blank agent-version entries are no longer replaced with a default at config.New() time: bootstrap is, however, expected to fill in an agent-version field before the config makes it into state. This shouldn't really be in this branch, but it got tangled through it; I'd really like to keep it in because it unblocks a couple of separate things I need. * followup: check for missing agent-version at bootstrap time; add checks to SetEnvironConfig to ensure it's never empty. https://code.launchpad.net/~fwereade/juju-core/upgrade-select-tools/+merge/158596 Requires: https://code.launchpad.net/~fwereade/juju-core/environs-tools-storage/+merge/157770 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : upgrade-juju: improvements #

Total comments: 1

Patch Set 3 : upgrade-juju: improvements #

Total comments: 101

Patch Set 4 : upgrade-juju: improvements #

Total comments: 21

Patch Set 5 : upgrade-juju: improvements #

Total comments: 2

Patch Set 6 : upgrade-juju: improvements #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1224 lines, -582 lines) Patch
A [revision details] View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/bootstrap.go View 1 2 3 4 5 5 chunks +27 lines, -7 lines 0 comments Download
M cmd/juju/bootstrap_test.go View 1 2 3 6 chunks +24 lines, -13 lines 0 comments Download
M cmd/juju/cmd_test.go View 1 2 3 2 chunks +1 line, -1 line 0 comments Download
M cmd/juju/environment.go View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M cmd/juju/environment_test.go View 1 2 3 2 chunks +3 lines, -1 line 0 comments Download
M cmd/juju/synctools.go View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M cmd/juju/upgradejuju.go View 1 2 3 4 3 chunks +211 lines, -103 lines 0 comments Download
M cmd/juju/upgradejuju_test.go View 1 2 3 3 chunks +269 lines, -109 lines 0 comments Download
M cmd/jujud/agent_test.go View 1 2 3 5 chunks +10 lines, -10 lines 0 comments Download
M cmd/jujud/upgrade.go View 1 2 3 4 3 chunks +32 lines, -34 lines 0 comments Download
M cmd/jujud/upgrade_test.go View 1 2 3 5 chunks +139 lines, -106 lines 0 comments Download
M environs/config/config.go View 1 2 3 4 chunks +24 lines, -13 lines 0 comments Download
M environs/config/config_test.go View 1 2 3 3 chunks +27 lines, -17 lines 0 comments Download
M environs/dummy/environs.go View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M environs/jujutest/livetests.go View 1 2 3 4 5 2 chunks +4 lines, -2 lines 0 comments Download
M environs/jujutest/tests.go View 1 2 3 4 2 chunks +2 lines, -0 lines 0 comments Download
M environs/testing/tools.go View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
M environs/tools.go View 1 2 3 4 chunks +57 lines, -4 lines 0 comments Download
M environs/tools/list.go View 1 2 3 4 5 chunks +15 lines, -4 lines 0 comments Download
M environs/tools/list_test.go View 1 2 3 5 chunks +57 lines, -34 lines 0 comments Download
M environs/tools/storage.go View 1 3 chunks +13 lines, -5 lines 0 comments Download
M environs/tools/storage_test.go View 1 chunk +6 lines, -0 lines 0 comments Download
M environs/tools_test.go View 1 2 3 8 chunks +227 lines, -52 lines 0 comments Download
M juju/testing/conn.go View 1 chunk +0 lines, -1 line 0 comments Download
M version/version.go View 1 2 3 4 5 3 chunks +10 lines, -5 lines 0 comments Download
M version/version_test.go View 2 chunks +53 lines, -60 lines 0 comments Download

Messages

Total messages: 12
fwereade
Please take a look. https://codereview.appspot.com/8663045/diff/2001/cmd/juju/bootstrap.go File cmd/juju/bootstrap.go (right): https://codereview.appspot.com/8663045/diff/2001/cmd/juju/bootstrap.go#newcode117 cmd/juju/bootstrap.go:117: set := map[string]bool{ Yes, this ...
11 years ago (2013-04-12 14:36:51 UTC) #1
rog
a first round of comments. i've got as far as environs/config :-) looks excellent in ...
11 years ago (2013-04-12 17:04:41 UTC) #2
rog
almost all minor comments, but i'd like to see it before you submit, please. https://codereview.appspot.com/8663045/diff/6001/environs/config/config.go ...
11 years ago (2013-04-12 17:30:06 UTC) #3
dimitern
Looks promising and a lot cleaner. I have mostly trivial suggestions and some questions. https://codereview.appspot.com/8663045/diff/6001/cmd/juju/bootstrap.go ...
11 years ago (2013-04-12 17:30:47 UTC) #4
fwereade
Please take a look. https://codereview.appspot.com/8663045/diff/6001/cmd/juju/bootstrap.go File cmd/juju/bootstrap.go (right): https://codereview.appspot.com/8663045/diff/6001/cmd/juju/bootstrap.go#newcode73 cmd/juju/bootstrap.go:73: series := getUploadSeries(cfg, c.Series) On ...
11 years ago (2013-04-14 01:35:07 UTC) #5
rog
thanks for the changes. i'm really quite concerned by the force-version semantics of upload-tools - ...
11 years ago (2013-04-14 22:26:16 UTC) #6
rog
thanks for the changes. i'm really quite concerned by the force-version semantics of upload-tools - ...
11 years ago (2013-04-14 22:26:20 UTC) #7
thumper
https://codereview.appspot.com/8663045/diff/21001/cmd/juju/bootstrap.go File cmd/juju/bootstrap.go (right): https://codereview.appspot.com/8663045/diff/21001/cmd/juju/bootstrap.go#newcode78 cmd/juju/bootstrap.go:78: cfg, err = cfg.Apply(map[string]interface{}{ We really should have a ...
11 years ago (2013-04-15 02:32:53 UTC) #8
dimitern
LGTM, much nicer - thanks for the changes! https://codereview.appspot.com/8663045/diff/21001/cmd/jujud/upgrade.go File cmd/jujud/upgrade.go (right): https://codereview.appspot.com/8663045/diff/21001/cmd/jujud/upgrade.go#newcode108 cmd/jujud/upgrade.go:108: // ...
11 years ago (2013-04-15 15:41:55 UTC) #9
fwereade
Please take a look. https://codereview.appspot.com/8663045/diff/6001/cmd/juju/bootstrap.go File cmd/juju/bootstrap.go (right): https://codereview.appspot.com/8663045/diff/6001/cmd/juju/bootstrap.go#newcode73 cmd/juju/bootstrap.go:73: series := getUploadSeries(cfg, c.Series) On ...
11 years ago (2013-04-16 02:04:31 UTC) #10
thumper
LGTM - thanks https://codereview.appspot.com/8663045/diff/50001/cmd/juju/bootstrap.go File cmd/juju/bootstrap.go (right): https://codereview.appspot.com/8663045/diff/50001/cmd/juju/bootstrap.go#newcode116 cmd/juju/bootstrap.go:116: if unique.Size() == 0 { I ...
11 years ago (2013-04-16 02:19:24 UTC) #11
fwereade
11 years ago (2013-04-17 04:26:31 UTC) #12
*** Submitted:

upgrade-juju: improvements

So, this started out as a quick branch to fix the versioning-related tests
in light of the change to dev versions. Quite a lot of the changes were
mechanical, by jujud.Upgrader and UpgradeJujuCommand demanded quite a lot
of careful thought and additional test coverage.

It should be noted that the dev versioning change made here is somewhat
cautious: it makes developiness contingent on (1) minor version oddity and
(2) build version existence. This is open to further discussion, and it will
be much easier to deal with further changes once this branch has landed.

The end result of my attempts to fix the various broken and/or untested
bits of the command was a rewritten command, with the following consequences
within the cmd/juju package.

  * bootstrap now accepts --series instead of --fake-series.
  * upgrade-juju also accepts --series.
  * --series is only valid when used with --upload-tools on either command;
  	in each case, it clones the tools built for the host series such that
	they are uploaded as the tools for all supplied series.
  * when --series is omitted, --upload-tools will assume that tools should
    be cloned for any of the following that are not the host series:
	  * precise (config.DefaultSeries), for which most charms are written;
	  * environment default-series, on which env machines will run.
  * --upload-tools now forces the reported number of the built tools to be
  	the same as the current CLI tools (plus a build number); this is wrong,
	in general, but it's consistently and mostly harmlessly so.
  * if a --version param is passed to upgrade-juju --upload-tools, it
  	instead builds the current source and forces its reported number to
	match the supplied version (plus unique build number) instead of the
	CLI version.
  * upgrade-juju no longer accepts --bump-version; as described above,
  	versions are now just bumped when they need to be.
  * upgrade-juju now communicates problems rather more helpfully I think.

The main implementation difference is that the detailed upgrade selection
logic is now centered on a separate type (which is somewhat badly named --
upgradeVersions). The command object's fields are now left unchanged from
their values at the end of Init, and Run-specific state is now held within
that method's scope.

One of the details of the implementation difference is that this is the
second place to use the tools.List style access and manipulation, exposed
via the new environs.FindAvailableTools func; branches to use it at
provisioning time and elsewhere should follow quickly.

The other drive-by changes are as follows:

  * version.Zero is slightly nicer than version.Number{}. Wish I could make
  	it const though :/.
  * tools.List has a new URLs method that returns its content as a map.
  * tools.Newest now also returns the version number shared by the tools
  	in the original result.
  * tests that got tweaked were frequently also reformatted for indentation
  	and vertical density.
  * blank agent-version entries are no longer replaced with a default at
    config.New() time: bootstrap is, however, expected to fill in an
	agent-version field before the config makes it into state. This
	shouldn't really be in this branch, but it got tangled through it;
	I'd really like to keep it in because it unblocks a couple of separate
	things I need.
	  * followup: check for missing agent-version at bootstrap time; add
	    checks to SetEnvironConfig to ensure it's never empty.

R=rog, dimitern, thumper
CC=
https://codereview.appspot.com/8663045
Sign in to reply to this message.

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