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 26, 2022
1 parent 3d00ece commit ba4e37c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
6 changes: 5 additions & 1 deletion config/fcos/v1_5_exp/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ type BootDeviceMirror struct {
Devices []string `yaml:"devices"`
}

type Extensions []string
type Extensions []Extension

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 ba4e37c

Please sign in to comment.