Skip to content

Commit

Permalink
review1
Browse files Browse the repository at this point in the history
s
  • Loading branch information
jmarrero committed Jan 20, 2022
1 parent 3039d41 commit 65f6687
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions config/fcos/v1_5_exp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package v1_5_exp

import (
"fmt"
"path/filepath"

baseutil "github.com/coreos/butane/base/util"
"github.com/coreos/butane/config/common"
Expand Down Expand Up @@ -83,9 +82,10 @@ func (c Config) ToIgn3_4Unvalidated(options common.TranslateOptions) (types.Conf

retp, rp, tsp := c.processPackages(options)

ret.Storage.Files = append(ret.Storage.Files, retp.Storage.Files...)
retConfig, retTranslations := baseutil.MergeTranslatedConfigs(retp, tsp, ret, ts)
ret = retConfig.(types.Config)
ts = retTranslations

ts.Merge(tsp)
r.Merge(rp)

return ret, ts, r
Expand Down Expand Up @@ -328,25 +328,28 @@ func (c Config) processPackages(options common.TranslateOptions) (types.Config,
return ret, r, ts
}

treeFilePath := filepath.Join("/etc", "rpm-ostree-layer.yaml")
treeFilePath := "/etc/rpm-ostree-layer.yaml"

file := types.File{
Node: types.Node{
Path: treeFilePath,
},
}

src, _, err := baseutil.MakeDataURL([]byte(marshalledYAML), nil, options.NoResourceAutoCompression)
src, gzipped, err := baseutil.MakeDataURL([]byte(marshalledYAML), file.Contents.Compression, !options.NoResourceAutoCompression)
if err != nil {
r.AddOnError(yamlPath, err)
return ret, r, ts
}
if gzipped {
file.Contents.Compression = util.StrToPtr("gzip")
}
file.Contents.Source = util.StrToPtr(src)
mode := 0644
file.Mode = &mode

ts.AddTranslation(yamlPath, path.New("json", "storage", "files", 0, "contents", "source"))
file.Mode = util.IntToPtr(0644)

ret.Storage.Files = append(ret.Storage.Files, file)
ts.AddFromCommonSource(yamlPath, path.New("json", "storage", "files", 0), file)

return ret, r, ts
}

0 comments on commit 65f6687

Please sign in to comment.