Skip to content

Commit

Permalink
config/fcos/v1_5_exp: use array of extension instead of string
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrero committed Jan 27, 2022
1 parent 3d00ece commit ac77c2b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 5 additions & 3 deletions config/fcos/v1_5_exp/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (

type Config struct {
base.Config `yaml:",inline"`
BootDevice BootDevice `yaml:"boot_device"`
Extensions Extensions `yaml:"extensions"`
BootDevice BootDevice `yaml:"boot_device"`
Extensions []Extension `yaml:"extensions"`
}

type BootDevice struct {
Expand All @@ -40,4 +40,6 @@ type BootDeviceMirror struct {
Devices []string `yaml:"devices"`
}

type Extensions []string
type Extension struct {
Name string `yaml:"name"`
}
7 changes: 5 additions & 2 deletions config/fcos/v1_5_exp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,14 @@ func (c Config) processPackages(options common.TranslateOptions) (types.Config,
if len(c.Extensions) == 0 {
return ret, ts, r
}

var extensions []string
for _, ex := range c.Extensions {
extensions = append(extensions, ex.Name)
}
treeFileContents, err := yaml.Marshal(&struct {
Packages []string `yaml:"packages"`
}{
Packages: c.Extensions,
Packages: extensions,
})
if err != nil {
r.AddOnError(yamlPath, err)
Expand Down
9 changes: 8 additions & 1 deletion config/fcos/v1_5_exp/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,14 @@ func TestTranslateExtensions(t *testing.T) {
// config with two extensions/packages
{
Config{
Extensions: []string{"strace", "zsh"},
Extensions: []Extension{
{
Name: "strace",
},
{
Name: "zsh",
},
},
},
types.Config{
Ignition: types.Ignition{
Expand Down

0 comments on commit ac77c2b

Please sign in to comment.