forked from rexray/rexray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types_config_compat.go
74 lines (58 loc) · 2.69 KB
/
types_config_compat.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
package types
import (
log "github.com/sirupsen/logrus"
gofig "github.com/akutz/gofig/types"
)
const (
//ConfigOldRoot is a config key.
ConfigOldRoot = "volume"
// ConfigOldIntegrationVolMountPreempt is a config key.
ConfigOldIntegrationVolMountPreempt = ConfigOldRoot + ".mount.preempt"
// ConfigOldIntegrationVolCreateDisable is a config key.
ConfigOldIntegrationVolCreateDisable = ConfigOldRoot + ".create.disable"
// ConfigOldIntegrationVolRemoveDisable is a config key.
ConfigOldIntegrationVolRemoveDisable = ConfigOldRoot + ".remove.disable"
// ConfigOldIntegrationVolUnmountIgnoreUsed is a config key.
ConfigOldIntegrationVolUnmountIgnoreUsed = ConfigOldRoot + ".unmount.ignoreusedcount"
// ConfigOldIntegrationVolPathCache is a config key.
ConfigOldIntegrationVolPathCache = ConfigOldRoot + ".path.cache"
//ConfigOldDocker is a config key.
ConfigOldDocker = "docker"
//ConfigOldDockerFsType is a config key.
ConfigOldDockerFsType = ConfigOldDocker + ".fsType"
//ConfigOldDockerVolumeType is a config key.
ConfigOldDockerVolumeType = ConfigOldDocker + ".volumeType"
//ConfigOldDockerIOPS is a config key.
ConfigOldDockerIOPS = ConfigOldDocker + ".iops"
//ConfigOldDockerSize is a config key.
ConfigOldDockerSize = ConfigOldDocker + ".size"
//ConfigOldDockerAvailabilityZone is a config key.
ConfigOldDockerAvailabilityZone = ConfigOldDocker + ".availabilityZone"
//ConfigOldDockerMountDirPath is a config key.
ConfigOldDockerMountDirPath = ConfigOldDocker + ".mountDirPath"
//ConfigOldDockerLinuxVolumeRootPath is a config key.
ConfigOldDockerLinuxVolumeRootPath = "linux.volume.rootpath"
)
// BackCompat ensures keys can be used from old configurations.
func BackCompat(config gofig.Config) {
checks := [][]string{
{ConfigIgVolOpsMountPreempt, ConfigOldIntegrationVolMountPreempt},
{ConfigIgVolOpsCreateDisable, ConfigOldIntegrationVolCreateDisable},
{ConfigIgVolOpsRemoveDisable, ConfigOldIntegrationVolRemoveDisable},
{ConfigIgVolOpsUnmountIgnoreUsed, ConfigOldIntegrationVolUnmountIgnoreUsed},
{ConfigIgVolOpsPathCacheEnabled, ConfigOldIntegrationVolPathCache},
{ConfigIgVolOpsCreateDefaultFsType, ConfigOldDockerFsType},
{ConfigIgVolOpsCreateDefaultType, ConfigOldDockerVolumeType},
{ConfigIgVolOpsCreateDefaultIOPS, ConfigOldDockerIOPS},
{ConfigIgVolOpsCreateDefaultSize, ConfigOldDockerSize},
{ConfigIgVolOpsCreateDefaultAZ, ConfigOldDockerAvailabilityZone},
{ConfigIgVolOpsMountPath, ConfigOldDockerMountDirPath},
{ConfigIgVolOpsMountRootPath, ConfigOldDockerLinuxVolumeRootPath},
}
for _, check := range checks {
if !config.IsSet(check[0]) && config.IsSet(check[1]) {
log.Debug(config.Get(check[1]))
config.Set(check[0], config.Get(check[1]))
}
}
}