~rogpeppe/juju-core/438-local-instance-Addresses

« back to all changes in this revision

Viewing changes to worker/upgrader/upgrader.go

[r=fwereade],[bug=1234035] Fix upgrade 1.14 -> 1.15

This adds a Tools() API call to provisioner API,
similarly to the upgrader API. Common code factored
out into apiserver/common/tools.go.

SetAgentTools() renamed to SetAgentVersion() in
machine and unit state types. Also renamed a few
types in params to be shorter or better reflect
what are they about. Added DEPRECATE(v1.18) tags
to bits of the API that need cleanup.

Live tested on EC2 - after copying the tools from
/tools/releases/ to /tools/ the upgrade proceeds
and finishes successfully.

https://codereview.appspot.com/14231044/

R=fwereade, jameinel

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
}
99
99
 
100
100
func (u *Upgrader) loop() error {
101
 
        currentTools, err := agenttools.ReadTools(u.dataDir, version.Current)
102
 
        if err != nil {
103
 
                // Don't abort everything because we can't find the tools directory.
104
 
                // The problem should sort itself out as we will immediately
105
 
                // download some more tools and upgrade.
106
 
                logger.Warningf("cannot read current tools: %v", err)
107
 
                currentTools = &coretools.Tools{
108
 
                        Version: version.Current,
109
 
                }
110
 
        }
111
 
        err = u.st.SetTools(u.tag, currentTools)
 
101
        currentTools := &coretools.Tools{Version: version.Current}
 
102
        err := u.st.SetVersion(u.tag, currentTools.Version)
112
103
        if err != nil {
113
104
                return err
114
105
        }