-
Notifications
You must be signed in to change notification settings - Fork 0
/
steps123.go
62 lines (57 loc) · 1.65 KB
/
steps123.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
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package upgrades
import (
"github.com/juju/utils/featureflag"
"github.com/juju/juju/feature"
"github.com/juju/juju/state"
)
// stateStepsFor123 returns upgrade steps form Juju 1.23 that manipulate state directly.
func stateStepsFor123() []Step {
var steps []Step
// TODO(axw) stop checking feature flag once storage has graduated.
if featureflag.Enabled(feature.Storage) {
steps = append(steps,
&upgradeStep{
description: "add default storage pools",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return addDefaultStoragePools(context.State())
},
},
)
}
steps = append(steps,
&upgradeStep{
description: "drop old mongo indexes",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return state.DropOldIndexesv123(context.State())
},
}, &upgradeStep{
description: "migrate envuuid to env-uuid in envUsersC",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return state.AddEnvUUIDToEnvUsersDoc(context.State())
},
},
&upgradeStep{
description: "move blocks from environment to state",
targets: []Target{DatabaseMaster},
run: func(context Context) error {
return moveBlocksFromEnvironToState(context)
},
},
)
return steps
}
// stepsFor123 returns upgrade steps form Juju 1.23 that only need the API.
func stepsFor123() []Step {
return []Step{
&upgradeStep{
description: "add environment UUID to agent config",
targets: []Target{AllMachines},
run: addEnvironmentUUIDToAgentConfig,
},
}
}