Use kebab case in option names

This commit is contained in:
DRON-666 2024-04-29 01:21:33 +03:00
parent 5703e5a652
commit 24330c19a8
2 changed files with 14 additions and 14 deletions

View file

@ -14,8 +14,8 @@ import (
// VSSConfig holds extended options of windows volume shadow copy service. // VSSConfig holds extended options of windows volume shadow copy service.
type VSSConfig struct { type VSSConfig struct {
ExcludeAllMountPoints bool `option:"excludeallmountpoints" help:"exclude mountpoints from snapshotting on all volumes"` ExcludeAllMountPoints bool `option:"exclude-all-mount-points" help:"exclude mountpoints from snapshotting on all volumes"`
ExcludeVolumes string `option:"excludevolumes" help:"semicolon separated list of volumes to exclude from snapshotting (ex. 'c:\\;e:\\mnt;\\\\?\\Volume{...}')"` ExcludeVolumes string `option:"exclude-volumes" help:"semicolon separated list of volumes to exclude from snapshotting (ex. 'c:\\;e:\\mnt;\\\\?\\Volume{...}')"`
Timeout time.Duration `option:"timeout" help:"time that the VSS can spend creating snapshot before timing out"` Timeout time.Duration `option:"timeout" help:"time that the VSS can spend creating snapshot before timing out"`
Provider string `option:"provider" help:"VSS provider identifier which will be used for snapshotting"` Provider string `option:"provider" help:"VSS provider identifier which will be used for snapshotting"`
} }
@ -80,7 +80,7 @@ func parseMountPoints(list string, msgError ErrorHandler) (volumes map[string]st
} }
for _, s := range strings.Split(list, ";") { for _, s := range strings.Split(list, ";") {
if v, err := GetVolumeNameForVolumeMountPoint(s); err != nil { if v, err := GetVolumeNameForVolumeMountPoint(s); err != nil {
msgError(s, errors.Errorf("failed to parse vss.excludevolumes [%s]: %s", s, err)) msgError(s, errors.Errorf("failed to parse vss.exclude-volumes [%s]: %s", s, err))
} else { } else {
if volumes == nil { if volumes == nil {
volumes = make(map[string]struct{}) volumes = make(map[string]struct{})

View file

@ -70,8 +70,8 @@ func TestVSSConfig(t *testing.T) {
}, },
{ {
options.Options{ options.Options{
"vss.excludeallmountpoints": "t", "vss.exclude-all-mount-points": "t",
"vss.provider": "{b5946137-7b9f-4925-af80-51abd60b20d5}", "vss.provider": "{b5946137-7b9f-4925-af80-51abd60b20d5}",
}, },
config{ config{
excludeAllMountPoints: true, excludeAllMountPoints: true,
@ -81,10 +81,10 @@ func TestVSSConfig(t *testing.T) {
}, },
{ {
options.Options{ options.Options{
"vss.excludeallmountpoints": "0", "vss.exclude-all-mount-points": "0",
"vss.excludevolumes": "", "vss.exclude-volumes": "",
"vss.timeout": "120s", "vss.timeout": "120s",
"vss.provider": "Microsoft Software Shadow Copy provider 1.0", "vss.provider": "Microsoft Software Shadow Copy provider 1.0",
}, },
config{ config{
timeout: 120000000000, timeout: 120000000000,
@ -148,7 +148,7 @@ func TestParseMountPoints(t *testing.T) {
}{ }{
{ {
options.Options{ options.Options{
"vss.excludevolumes": `c:;c:\;` + sysVolume + `;` + sysVolumeMutated, "vss.exclude-volumes": `c:;c:\;` + sysVolume + `;` + sysVolumeMutated,
}, },
[]string{ []string{
sysVolumeMatch, sysVolumeMatch,
@ -163,7 +163,7 @@ func TestParseMountPoints(t *testing.T) {
}, },
{ {
options.Options{ options.Options{
"vss.excludevolumes": `z:\nonexistent;c:;c:\windows\;\\?\Volume{39b9cac2-bcdb-4d51-97c8-0d0677d607fb}\`, "vss.exclude-volumes": `z:\nonexistent;c:;c:\windows\;\\?\Volume{39b9cac2-bcdb-4d51-97c8-0d0677d607fb}\`,
}, },
[]string{ []string{
sysVolumeMatch, sysVolumeMatch,
@ -175,9 +175,9 @@ func TestParseMountPoints(t *testing.T) {
{``, false}, {``, false},
}, },
[]string{ []string{
`failed to parse vss\.excludevolumes \[z:\\nonexistent\]:.*`, `failed to parse vss\.exclude-volumes \[z:\\nonexistent\]:.*`,
`failed to parse vss\.excludevolumes \[c:\\windows\\\]:.*`, `failed to parse vss\.exclude-volumes \[c:\\windows\\\]:.*`,
`failed to parse vss\.excludevolumes \[\\\\\?\\Volume\{39b9cac2-bcdb-4d51-97c8-0d0677d607fb\}\\\]:.*`, `failed to parse vss\.exclude-volumes \[\\\\\?\\Volume\{39b9cac2-bcdb-4d51-97c8-0d0677d607fb\}\\\]:.*`,
`failed to get volume from mount point \[c:\\windows\\\]:.*`, `failed to get volume from mount point \[c:\\windows\\\]:.*`,
`failed to get volume from mount point \[\\\\\?\\Volume\{39b9cac2-bcdb-4d51-97c8-0d0677d607fb\}\\\]:.*`, `failed to get volume from mount point \[\\\\\?\\Volume\{39b9cac2-bcdb-4d51-97c8-0d0677d607fb\}\\\]:.*`,
`failed to get volume from mount point \[\]:.*`, `failed to get volume from mount point \[\]:.*`,