forked from juju/juju
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsteps_20.go
48 lines (43 loc) · 1.27 KB
/
steps_20.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2016 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package upgrades
import (
"os"
"path/filepath"
)
// stateStepsFor20 returns upgrade steps for Juju 2.0 that manipulate state directly.
func stateStepsFor20() []Step {
return []Step{
&upgradeStep{
description: "strip @local from local user names",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().StripLocalUserDomain()
},
},
&upgradeStep{
description: "rename addmodel permission to add-model",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().RenameAddModelPermission()
},
},
}
}
// stepsFor20 returns upgrade steps for Juju 2.0 that only need the API.
func stepsFor20() []Step {
return []Step{
&upgradeStep{
description: "remove apiserver charm get cache",
targets: []Target{Controller},
run: removeCharmGetCache,
},
}
}
// removeCharmGetCache removes the cache directory that was previously
// used by the charms API endpoint. It is no longer necessary.
func removeCharmGetCache(context Context) error {
dataDir := context.AgentConfig().DataDir()
cacheDir := filepath.Join(dataDir, "charm-get-cache")
return os.RemoveAll(cacheDir)
}