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

« back to all changes in this revision

Viewing changes to worker/provisioner/provisioner.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:
11
11
        "launchpad.net/tomb"
12
12
 
13
13
        "launchpad.net/juju-core/agent"
14
 
        agenttools "launchpad.net/juju-core/agent/tools"
15
14
        "launchpad.net/juju-core/environs"
16
15
        "launchpad.net/juju-core/environs/config"
17
16
        "launchpad.net/juju-core/instance"
18
17
        apiprovisioner "launchpad.net/juju-core/state/api/provisioner"
19
18
        "launchpad.net/juju-core/state/watcher"
20
19
        coretools "launchpad.net/juju-core/tools"
21
 
        "launchpad.net/juju-core/version"
22
20
        "launchpad.net/juju-core/worker"
23
21
)
24
22
 
191
189
}
192
190
 
193
191
func (p *Provisioner) getAgentTools() (*coretools.Tools, error) {
194
 
        dataDir := p.agentConfig.DataDir()
195
 
        tools, err := agenttools.ReadTools(dataDir, version.Current)
196
 
        if err != nil {
197
 
                logger.Errorf("cannot read agent tools from %q", dataDir)
198
 
                return nil, err
199
 
        }
200
 
        return tools, nil
 
192
        return p.st.Tools(p.agentConfig.Tag())
201
193
}
202
194
 
203
195
// setConfig updates the environment configuration and notifies