-
Notifications
You must be signed in to change notification settings - Fork 0
/
steps_22.go
75 lines (70 loc) · 2.17 KB
/
steps_22.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright 2017 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package upgrades
import (
"os"
"path/filepath"
)
// stateStepsFor22 returns upgrade steps for Juju 2.2 that manipulate state directly.
func stateStepsFor22() []Step {
return []Step{
&upgradeStep{
description: "add machineid to non-detachable storage docs",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().AddNonDetachableStorageMachineId()
},
},
&upgradeStep{
description: "remove application config settings with nil value",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().RemoveNilValueApplicationSettings()
},
},
&upgradeStep{
description: "add controller log collection sizing config settings",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().AddControllerLogCollectionsSizeSettings()
},
},
&upgradeStep{
description: "add status history pruning config settings",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().AddStatusHistoryPruneSettings()
},
},
&upgradeStep{
description: "add storage constraints to storage instance docs",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().AddStorageInstanceConstraints()
},
},
&upgradeStep{
description: "split log collections",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return context.State().SplitLogCollections()
},
},
}
}
// stepsFor22 returns upgrade steps for Juju 2.2 that only need the API.
func stepsFor22() []Step {
return []Step{
&upgradeStep{
description: "remove meter status file",
targets: []Target{AllMachines},
run: removeMeterStatusFile,
},
}
}
// removeMeterStatusFile removes the meter status file from the agent data directory.
func removeMeterStatusFile(context Context) error {
dataDir := context.AgentConfig().DataDir()
meterStatusFile := filepath.Join(dataDir, "meter-status.yaml")
return os.RemoveAll(meterStatusFile)
}