config: deprecate - in favor of _ for key names

In all of the YAML tags, - has been replaced with _. normalizeConfig() and
normalizeKeys() have also been added to perform the normalization of the input
cloud-config.

As part of the normalization process, falsey values are converted to "false".
The "off" update strategy is no exception and as a result the "off" update
strategy has been changed to "false".
This commit is contained in:
Alex Crawford
2014-11-03 12:09:52 -08:00
parent e9bda98b54
commit d02aa18839
9 changed files with 119 additions and 61 deletions

View File

@@ -126,7 +126,7 @@ func (uc Update) Units() []Unit {
Runtime: true,
}}
if uc.Update.RebootStrategy == "off" {
if uc.Update.RebootStrategy == "false" {
ls.Command = "stop"
ls.Mask = true
}

View File

@@ -73,7 +73,7 @@ func TestUpdateUnits(t *testing.T) {
}}},
},
{
config: config.Update{RebootStrategy: "off"},
config: config.Update{RebootStrategy: "false"},
units: []Unit{{config.Unit{
Name: "locksmithd.service",
Command: "stop",
@@ -101,7 +101,7 @@ func TestUpdateFile(t *testing.T) {
},
{
config: config.Update{RebootStrategy: "wizzlewazzle"},
err: errors.New("invalid value \"wizzlewazzle\" for option \"RebootStrategy\" (valid options: \"best-effort,etcd-lock,reboot,off\")"),
err: errors.New("invalid value \"wizzlewazzle\" for option \"RebootStrategy\" (valid options: \"best-effort,etcd-lock,reboot,false\")"),
},
{
config: config.Update{Group: "master", Server: "http://foo.com"},
@@ -136,9 +136,9 @@ func TestUpdateFile(t *testing.T) {
}},
},
{
config: config.Update{RebootStrategy: "off"},
config: config.Update{RebootStrategy: "false"},
file: &File{config.File{
Content: "REBOOT_STRATEGY=off\n",
Content: "REBOOT_STRATEGY=false\n",
Path: "etc/coreos/update.conf",
RawFilePermissions: "0644",
}},