From dda7754ae9fe8e46a20ff8a5deaa48deb520ca2f Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Fri, 24 Jan 2020 11:07:14 -0500 Subject: [PATCH] base/v0_2_exp: translate filesystem.mountOptions field --- base/v0_2_exp/schema.go | 1 + base/v0_2_exp/translate.go | 3 ++- base/v0_2_exp/translate_test.go | 2 ++ docs/configuration-v1_1-exp.md | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/base/v0_2_exp/schema.go b/base/v0_2_exp/schema.go index efe9bc51..f74b0e72 100644 --- a/base/v0_2_exp/schema.go +++ b/base/v0_2_exp/schema.go @@ -73,6 +73,7 @@ type Filesystem struct { Device string `yaml:"device"` Format *string `yaml:"format"` Label *string `yaml:"label"` + MountOptions []string `yaml:"mount_options"` Options []string `yaml:"options"` Path *string `yaml:"path"` UUID *string `yaml:"uuid"` diff --git a/base/v0_2_exp/translate.go b/base/v0_2_exp/translate.go index ddf9c248..3bee4d33 100644 --- a/base/v0_2_exp/translate.go +++ b/base/v0_2_exp/translate.go @@ -125,7 +125,8 @@ func translateLink(from Link) (to types.Link, tm translate.TranslationSet) { func translateFilesystem(from Filesystem) (to types.Filesystem, tm translate.TranslationSet) { tr := translate.NewTranslator("yaml", "json") - tm = tr.Translate(&from.Options, &to.Options).Prefix("options") + tm = tr.Translate(&from.MountOptions, &to.MountOptions).Prefix("mount_options") + tm.MergeP("options", tr.Translate(&from.Options, &to.Options)) to.Device = from.Device to.Label = from.Label to.Format = from.Format diff --git a/base/v0_2_exp/translate_test.go b/base/v0_2_exp/translate_test.go index df22ef71..31c0e2ed 100644 --- a/base/v0_2_exp/translate_test.go +++ b/base/v0_2_exp/translate_test.go @@ -290,6 +290,7 @@ func TestTranslateFilesystem(t *testing.T) { Device: "/foo", Format: util.StrToPtr("/bar"), Label: util.StrToPtr("/baz"), + MountOptions: []string{"yes", "no", "maybe"}, Options: []string{"foo", "foo", "bar"}, Path: util.StrToPtr("/quux"), UUID: util.StrToPtr("1234"), @@ -300,6 +301,7 @@ func TestTranslateFilesystem(t *testing.T) { Device: "/foo", Format: util.StrToPtr("/bar"), Label: util.StrToPtr("/baz"), + MountOptions: []types.MountOption{"yes", "no", "maybe"}, Options: []types.FilesystemOption{"foo", "foo", "bar"}, Path: util.StrToPtr("/quux"), UUID: util.StrToPtr("1234"), diff --git a/docs/configuration-v1_1-exp.md b/docs/configuration-v1_1-exp.md index 6e34b55f..cea0f85d 100644 --- a/docs/configuration-v1_1-exp.md +++ b/docs/configuration-v1_1-exp.md @@ -56,6 +56,7 @@ The Fedora CoreOS configuration is a YAML document conforming to the following s * **_label_** (string): the label of the filesystem. * **_uuid_** (string): the uuid of the filesystem. * **_options_** (list of strings): any additional options to be passed to the format-specific mkfs utility. + * **_mount_options_** (list of strings): any special options to be passed to the mount command. * **_with_mount_unit_** (bool): Whether to generate a generic mount unit for this filesystem as well. If a more specific unit is needed, a custom one can be specified in the `systemd.units` section. The unit will be named with the [escaped][systemd-escape] version of the `path`. * **_files_** (list of objects): the list of files to be written. Every file, directory and link must have a unique `path`. * **path** (string): the absolute path to the file.