Skip to content

Commit

Permalink
*_exp: update ignition import to reflect latest version
Browse files Browse the repository at this point in the history
update naming from 3_5 to 3_6 and replace import statements on
all config/distro/*_exp and base_exp
  • Loading branch information
prestist committed Nov 22, 2024
1 parent baf9c1c commit 9216cc6
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 69 deletions.
6 changes: 3 additions & 3 deletions base/v0_7_exp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

"github.com/coreos/go-systemd/v22/unit"
"github.com/coreos/ignition/v2/config/util"
"github.com/coreos/ignition/v2/config/v3_5/types"
"github.com/coreos/ignition/v2/config/v3_6_experimental/types"

Check failure on line 32 in base/v0_7_exp/translate.go

View workflow job for this annotation

GitHub Actions / Test (1.22.x, ubuntu-latest)

cannot find module providing package github.com/coreos/ignition/v2/config/v3_6_experimental/types: import lookup disabled by -mod=vendor

Check failure on line 32 in base/v0_7_exp/translate.go

View workflow job for this annotation

GitHub Actions / Regenerate

cannot find module providing package github.com/coreos/ignition/v2/config/v3_6_experimental/types: import lookup disabled by -mod=vendor

Check failure on line 32 in base/v0_7_exp/translate.go

View workflow job for this annotation

GitHub Actions / Test (1.23.x, ubuntu-latest)

cannot find module providing package github.com/coreos/ignition/v2/config/v3_6_experimental/types: import lookup disabled by -mod=vendor
"github.com/coreos/vcontext/path"
"github.com/coreos/vcontext/report"
)
Expand Down Expand Up @@ -75,10 +75,10 @@ RequiredBy=local-fs.target
{{- end }}`))
)

// ToIgn3_5Unvalidated translates the config to an Ignition config. It also returns the set of translations
// ToIgn3_6Unvalidated translates the config to an Ignition config. It also returns the set of translations
// it did so paths in the resultant config can be tracked back to their source in the source config.
// No config validation is performed on input or output.
func (c Config) ToIgn3_5Unvalidated(options common.TranslateOptions) (types.Config, translate.TranslationSet, report.Report) {
func (c Config) ToIgn3_6Unvalidated(options common.TranslateOptions) (types.Config, translate.TranslationSet, report.Report) {
ret := types.Config{}

tr := translate.NewTranslator("yaml", "json", options)
Expand Down
18 changes: 9 additions & 9 deletions base/v0_7_exp/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/coreos/butane/translate"

"github.com/coreos/ignition/v2/config/util"
"github.com/coreos/ignition/v2/config/v3_5/types"
"github.com/coreos/ignition/v2/config/v3_6_experimental/types"
"github.com/coreos/vcontext/path"
"github.com/coreos/vcontext/report"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -765,7 +765,7 @@ func TestTranslateFilesystem(t *testing.T) {
},
}
expected := []types.Filesystem{test.out}
actual, translations, r := in.ToIgn3_5Unvalidated(common.TranslateOptions{})
actual, translations, r := in.ToIgn3_6Unvalidated(common.TranslateOptions{})
r = confutil.TranslateReportPaths(r, translations)
baseutil.VerifyReport(t, test.in, r)
assert.Equal(t, expected, actual.Storage.Filesystems, "translation mismatch")
Expand Down Expand Up @@ -1189,7 +1189,7 @@ RequiredBy=swap.target`),

for i, test := range tests {
t.Run(fmt.Sprintf("translate %d", i), func(t *testing.T) {
out, translations, r := test.in.ToIgn3_5Unvalidated(common.TranslateOptions{})
out, translations, r := test.in.ToIgn3_6Unvalidated(common.TranslateOptions{})
r = confutil.TranslateReportPaths(r, translations)
baseutil.VerifyReport(t, test.in, r)
assert.Equal(t, test.out, out, "bad output")
Expand Down Expand Up @@ -1716,7 +1716,7 @@ func TestTranslateTree(t *testing.T) {
if test.options != nil {
options = *test.options
}
actual, translations, r := config.ToIgn3_5Unvalidated(options)
actual, translations, r := config.ToIgn3_6Unvalidated(options)

r = confutil.TranslateReportPaths(r, translations)
baseutil.VerifyReport(t, config, r)
Expand Down Expand Up @@ -1871,7 +1871,7 @@ func TestTranslateKernelArguments(t *testing.T) {
}
for i, test := range tests {
t.Run(fmt.Sprintf("translate %d", i), func(t *testing.T) {
actual, translations, r := test.in.ToIgn3_5Unvalidated(common.TranslateOptions{})
actual, translations, r := test.in.ToIgn3_6Unvalidated(common.TranslateOptions{})
r = confutil.TranslateReportPaths(r, translations)
baseutil.VerifyReport(t, test.in, r)
assert.Equal(t, test.out, actual, "translation mismatch")
Expand Down Expand Up @@ -1946,7 +1946,7 @@ func TestTranslateTang(t *testing.T) {
}
for i, test := range tests {
t.Run(fmt.Sprintf("translate %d", i), func(t *testing.T) {
actual, translations, r := test.in.ToIgn3_5Unvalidated(common.TranslateOptions{})
actual, translations, r := test.in.ToIgn3_6Unvalidated(common.TranslateOptions{})
r = confutil.TranslateReportPaths(r, translations)
baseutil.VerifyReport(t, test.in, r)
assert.Equal(t, test.out, actual, "translation mismatch")
Expand Down Expand Up @@ -2335,9 +2335,9 @@ func TestTranslateUnitLocal(t *testing.T) {
}
}

// TestToIgn3_5 tests the config.ToIgn3_5 function ensuring it will generate a valid config even when empty. Not much else is
// TestToIgn3_6 tests the config.ToIgn3_6 function ensuring it will generate a valid config even when empty. Not much else is
// tested since it uses the Ignition translation code which has its own set of tests.
func TestToIgn3_5(t *testing.T) {
func TestToIgn3_6(t *testing.T) {
tests := []struct {
in Config
out types.Config
Expand All @@ -2353,7 +2353,7 @@ func TestToIgn3_5(t *testing.T) {
}
for i, test := range tests {
t.Run(fmt.Sprintf("translate %d", i), func(t *testing.T) {
actual, translations, r := test.in.ToIgn3_5Unvalidated(common.TranslateOptions{})
actual, translations, r := test.in.ToIgn3_6Unvalidated(common.TranslateOptions{})
r = confutil.TranslateReportPaths(r, translations)
baseutil.VerifyReport(t, test.in, r)
assert.Equal(t, test.out, actual, "translation mismatch")
Expand Down
2 changes: 1 addition & 1 deletion base/v0_7_exp/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package v0_7_exp

import (
"github.com/coreos/ignition/v2/config/v3_5/types"
"github.com/coreos/ignition/v2/config/v3_6_experimental/types"
)

type nodeTracker struct {
Expand Down
8 changes: 4 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ func init() {
RegisterTranslator("fcos", "1.4.0", fcos1_4.ToIgn3_3Bytes)
RegisterTranslator("fcos", "1.5.0", fcos1_5.ToIgn3_4Bytes)
RegisterTranslator("fcos", "1.6.0", fcos1_6.ToIgn3_5Bytes)
RegisterTranslator("fcos", "1.7.0-experimental", fcos1_7_exp.ToIgn3_5Bytes)
RegisterTranslator("fcos", "1.7.0-experimental", fcos1_7_exp.ToIgn3_6Bytes)
RegisterTranslator("flatcar", "1.0.0", flatcar1_0.ToIgn3_3Bytes)
RegisterTranslator("flatcar", "1.1.0", flatcar1_1.ToIgn3_4Bytes)
RegisterTranslator("flatcar", "1.2.0", flatcar1_2.ToIgn3_5Bytes)
RegisterTranslator("flatcar", "1.3.0-experimental", flatcar1_3_exp.ToIgn3_5Bytes)
RegisterTranslator("flatcar", "1.3.0-experimental", flatcar1_3_exp.ToIgn3_6Bytes)
RegisterTranslator("openshift", "4.8.0", openshift4_8.ToConfigBytes)
RegisterTranslator("openshift", "4.9.0", openshift4_9.ToConfigBytes)
RegisterTranslator("openshift", "4.10.0", openshift4_10.ToConfigBytes)
Expand All @@ -91,10 +91,10 @@ func init() {
RegisterTranslator("r4e", "1.0.0", r4e1_0.ToIgn3_3Bytes)
RegisterTranslator("r4e", "1.1.0", r4e1_1.ToIgn3_4Bytes)
RegisterTranslator("r4e", "1.2.0", r4e1_2.ToIgn3_5Bytes)
RegisterTranslator("r4e", "1.3.0-experimental", r4e1_3_exp.ToIgn3_5Bytes)
RegisterTranslator("r4e", "1.3.0-experimental", r4e1_3_exp.ToIgn3_6Bytes)
RegisterTranslator("fiot", "1.0.0", fiot1_0.ToIgn3_4Bytes)
RegisterTranslator("fiot", "1.1.0", fiot1_1.ToIgn3_5Bytes)
RegisterTranslator("fiot", "1.2.0-experimental", fiot1_2_exp.ToIgn3_5Bytes)
RegisterTranslator("fiot", "1.2.0-experimental", fiot1_2_exp.ToIgn3_6Bytes)
RegisterTranslator("rhcos", "0.1.0", unsupportedRhcosVariant)
}

Expand Down
20 changes: 10 additions & 10 deletions config/fcos/v1_7_exp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/coreos/butane/translate"

"github.com/coreos/ignition/v2/config/util"
"github.com/coreos/ignition/v2/config/v3_5/types"
"github.com/coreos/ignition/v2/config/v3_6_experimental/types"
"github.com/coreos/vcontext/path"
"github.com/coreos/vcontext/report"
)
Expand Down Expand Up @@ -60,12 +60,12 @@ func (c Config) FieldFilters() *cutil.FieldFilters {
return nil
}

// ToIgn3_5Unvalidated translates the config to an Ignition config. It also
// ToIgn3_6Unvalidated translates the config to an Ignition config. It also
// returns the set of translations it did so paths in the resultant config
// can be tracked back to their source in the source config. No config
// validation is performed on input or output.
func (c Config) ToIgn3_5Unvalidated(options common.TranslateOptions) (types.Config, translate.TranslationSet, report.Report) {
ret, ts, r := c.Config.ToIgn3_5Unvalidated(options)
func (c Config) ToIgn3_6Unvalidated(options common.TranslateOptions) (types.Config, translate.TranslationSet, report.Report) {
ret, ts, r := c.Config.ToIgn3_6Unvalidated(options)
if r.IsFatal() {
return types.Config{}, translate.TranslationSet{}, r
}
Expand All @@ -92,20 +92,20 @@ func (c Config) ToIgn3_5Unvalidated(options common.TranslateOptions) (types.Conf
return ret, ts, r
}

// ToIgn3_5 translates the config to an Ignition config. It returns a
// ToIgn3_6 translates the config to an Ignition config. It returns a
// report of any errors or warnings in the source and resultant config. If
// the report has fatal errors or it encounters other problems translating,
// an error is returned.
func (c Config) ToIgn3_5(options common.TranslateOptions) (types.Config, report.Report, error) {
cfg, r, err := cutil.Translate(c, "ToIgn3_5Unvalidated", options)
func (c Config) ToIgn3_6(options common.TranslateOptions) (types.Config, report.Report, error) {
cfg, r, err := cutil.Translate(c, "ToIgn3_6Unvalidated", options)
return cfg.(types.Config), r, err
}

// ToIgn3_5Bytes translates from a v1.6 Butane config to a v3.5.0 Ignition config. It returns a report of any errors or
// ToIgn3_6Bytes translates from a v1.6 Butane config to a v3.5.0 Ignition config. It returns a report of any errors or
// warnings in the source and resultant config. If the report has fatal errors or it encounters other problems
// translating, an error is returned.
func ToIgn3_5Bytes(input []byte, options common.TranslateBytesOptions) ([]byte, report.Report, error) {
return cutil.TranslateBytes(input, &Config{}, "ToIgn3_5", options)
func ToIgn3_6Bytes(input []byte, options common.TranslateBytesOptions) ([]byte, report.Report, error) {
return cutil.TranslateBytes(input, &Config{}, "ToIgn3_6", options)
}

func (c Config) processBootDevice(config *types.Config, ts *translate.TranslationSet, options common.TranslateOptions) report.Report {
Expand Down
6 changes: 3 additions & 3 deletions config/fcos/v1_7_exp/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/coreos/butane/translate"

"github.com/coreos/ignition/v2/config/util"
"github.com/coreos/ignition/v2/config/v3_5/types"
"github.com/coreos/ignition/v2/config/v3_6_experimental/types"
"github.com/coreos/vcontext/path"
"github.com/coreos/vcontext/report"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -1495,7 +1495,7 @@ func TestTranslateBootDevice(t *testing.T) {

for i, test := range tests {
t.Run(fmt.Sprintf("translate %d", i), func(t *testing.T) {
actual, translations, r := test.in.ToIgn3_5Unvalidated(common.TranslateOptions{})
actual, translations, r := test.in.ToIgn3_6Unvalidated(common.TranslateOptions{})
r = confutil.TranslateReportPaths(r, translations)
baseutil.VerifyReport(t, test.in, r)
assert.Equal(t, test.out, actual, "translation mismatch")
Expand Down Expand Up @@ -1627,7 +1627,7 @@ func TestTranslateGrub(t *testing.T) {

for i, test := range tests {
t.Run(fmt.Sprintf("translate %d", i), func(t *testing.T) {
actual, translations, r := test.in.ToIgn3_5Unvalidated(common.TranslateOptions{})
actual, translations, r := test.in.ToIgn3_6Unvalidated(common.TranslateOptions{})
r = confutil.TranslateReportPaths(r, translations)
baseutil.VerifyReport(t, test.in, r)
assert.Equal(t, test.out, actual, "translation mismatch")
Expand Down
2 changes: 1 addition & 1 deletion config/fcos/v1_7_exp/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func TestReportCorrelation(t *testing.T) {

for i, test := range tests {
t.Run(fmt.Sprintf("validate %d", i), func(t *testing.T) {
_, r, _ := ToIgn3_5Bytes([]byte(test.in), common.TranslateBytesOptions{})
_, r, _ := ToIgn3_6Bytes([]byte(test.in), common.TranslateBytesOptions{})
assert.Len(t, r.Entries, 1, "unexpected report length")
assert.Equal(t, test.message, r.Entries[0].Message, "bad error")
assert.NotNil(t, r.Entries[0].Marker.StartP, "marker start is nil")
Expand Down
14 changes: 7 additions & 7 deletions config/fiot/v1_2_exp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/coreos/butane/config/common"
cutil "github.com/coreos/butane/config/util"

"github.com/coreos/ignition/v2/config/v3_5/types"
"github.com/coreos/ignition/v2/config/v3_6_experimental/types"
"github.com/coreos/vcontext/report"
)

Expand All @@ -37,18 +37,18 @@ func (c Config) FieldFilters() *cutil.FieldFilters {
return &fieldFilters
}

// ToIgn3_5 translates the config to an Ignition config. It returns a
// ToIgn3_6 translates the config to an Ignition config. It returns a
// report of any errors or warnings in the source and resultant config. If
// the report has fatal errors or it encounters other problems translating,
// an error is returned.
func (c Config) ToIgn3_5(options common.TranslateOptions) (types.Config, report.Report, error) {
cfg, r, err := cutil.Translate(c, "ToIgn3_5Unvalidated", options)
func (c Config) ToIgn3_6(options common.TranslateOptions) (types.Config, report.Report, error) {
cfg, r, err := cutil.Translate(c, "ToIgn3_6Unvalidated", options)
return cfg.(types.Config), r, err
}

// ToIgn3_5Bytes translates from a v1.2 Butane config to a v3.5.0 Ignition config. It returns a report of any errors or
// ToIgn3_6Bytes translates from a v1.2 Butane config to a v3.5.0 Ignition config. It returns a report of any errors or
// warnings in the source and resultant config. If the report has fatal errors or it encounters other problems
// translating, an error is returned.
func ToIgn3_5Bytes(input []byte, options common.TranslateBytesOptions) ([]byte, report.Report, error) {
return cutil.TranslateBytes(input, &Config{}, "ToIgn3_5", options)
func ToIgn3_6Bytes(input []byte, options common.TranslateBytesOptions) ([]byte, report.Report, error) {
return cutil.TranslateBytes(input, &Config{}, "ToIgn3_6", options)
}
2 changes: 1 addition & 1 deletion config/fiot/v1_2_exp/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func TestTranslateInvalid(t *testing.T) {
for _, entry := range test.Entries {
expectedReport.AddOnError(entry.Path, entry.Err)
}
actual, translations, r := test.In.ToIgn3_5Unvalidated(common.TranslateOptions{})
actual, translations, r := test.In.ToIgn3_6Unvalidated(common.TranslateOptions{})
r.Merge(fieldFilters.Verify(actual))
r = confutil.TranslateReportPaths(r, translations)
baseutil.VerifyReport(t, test.In, r)
Expand Down
14 changes: 7 additions & 7 deletions config/flatcar/v1_3_exp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/coreos/butane/config/common"
cutil "github.com/coreos/butane/config/util"

"github.com/coreos/ignition/v2/config/v3_5/types"
"github.com/coreos/ignition/v2/config/v3_6_experimental/types"
"github.com/coreos/vcontext/report"
)

Expand All @@ -33,18 +33,18 @@ func (c Config) FieldFilters() *cutil.FieldFilters {
return &fieldFilters
}

// ToIgn3_5 translates the config to an Ignition config. It returns a
// ToIgn3_6 translates the config to an Ignition config. It returns a
// report of any errors or warnings in the source and resultant config. If
// the report has fatal errors or it encounters other problems translating,
// an error is returned.
func (c Config) ToIgn3_5(options common.TranslateOptions) (types.Config, report.Report, error) {
cfg, r, err := cutil.Translate(c, "ToIgn3_5Unvalidated", options)
func (c Config) ToIgn3_6(options common.TranslateOptions) (types.Config, report.Report, error) {
cfg, r, err := cutil.Translate(c, "ToIgn3_6Unvalidated", options)
return cfg.(types.Config), r, err
}

// ToIgn3_5Bytes translates from a v1.2 Butane config to a v3.5.0 Ignition config. It returns a report of any errors or
// ToIgn3_6Bytes translates from a v1.2 Butane config to a v3.5.0 Ignition config. It returns a report of any errors or
// warnings in the source and resultant config. If the report has fatal errors or it encounters other problems
// translating, an error is returned.
func ToIgn3_5Bytes(input []byte, options common.TranslateBytesOptions) ([]byte, report.Report, error) {
return cutil.TranslateBytes(input, &Config{}, "ToIgn3_5", options)
func ToIgn3_6Bytes(input []byte, options common.TranslateBytesOptions) ([]byte, report.Report, error) {
return cutil.TranslateBytes(input, &Config{}, "ToIgn3_6", options)
}
2 changes: 1 addition & 1 deletion config/flatcar/v1_3_exp/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestTranslation(t *testing.T) {
for _, entry := range test.entries {
expectedReport.AddOn(entry.path, entry.err, entry.kind)
}
actual, translations, r := test.in.ToIgn3_5Unvalidated(common.TranslateOptions{})
actual, translations, r := test.in.ToIgn3_6Unvalidated(common.TranslateOptions{})
if test.in.FieldFilters() != nil {
r.Merge(test.in.FieldFilters().Verify(actual))
}
Expand Down
2 changes: 1 addition & 1 deletion config/openshift/v4_18_exp/result/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package result

import (
"github.com/coreos/ignition/v2/config/v3_5/types"
"github.com/coreos/ignition/v2/config/v3_6_experimental/types"
)

const (
Expand Down
16 changes: 8 additions & 8 deletions config/openshift/v4_18_exp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/coreos/butane/translate"

"github.com/coreos/ignition/v2/config/util"
"github.com/coreos/ignition/v2/config/v3_5/types"
"github.com/coreos/ignition/v2/config/v3_6_experimental/types"
"github.com/coreos/vcontext/path"
"github.com/coreos/vcontext/report"
)
Expand Down Expand Up @@ -113,7 +113,7 @@ func (c Config) FieldFilters() *cutil.FieldFilters {
// can be tracked back to their source in the source config. No config
// validation is performed on input or output.
func (c Config) ToMachineConfig4_18Unvalidated(options common.TranslateOptions) (result.MachineConfig, translate.TranslationSet, report.Report) {
cfg, ts, r := c.Config.ToIgn3_5Unvalidated(options)
cfg, ts, r := c.Config.ToIgn3_6Unvalidated(options)
if r.IsFatal() {
return result.MachineConfig{}, ts, r
}
Expand Down Expand Up @@ -174,11 +174,11 @@ func (c Config) ToMachineConfig4_18(options common.TranslateOptions) (result.Mac
return cfg.(result.MachineConfig), r, err
}

// ToIgn3_5Unvalidated translates the config to an Ignition config. It also
// ToIgn3_6Unvalidated translates the config to an Ignition config. It also
// returns the set of translations it did so paths in the resultant config
// can be tracked back to their source in the source config. No config
// validation is performed on input or output.
func (c Config) ToIgn3_5Unvalidated(options common.TranslateOptions) (types.Config, translate.TranslationSet, report.Report) {
func (c Config) ToIgn3_6Unvalidated(options common.TranslateOptions) (types.Config, translate.TranslationSet, report.Report) {
mc, ts, r := c.ToMachineConfig4_18Unvalidated(options)
cfg := mc.Spec.Config

Expand All @@ -194,12 +194,12 @@ func (c Config) ToIgn3_5Unvalidated(options common.TranslateOptions) (types.Conf
return cfg, ts, r
}

// ToIgn3_5 translates the config to an Ignition config. It returns a
// ToIgn3_6 translates the config to an Ignition config. It returns a
// report of any errors or warnings in the source and resultant config. If
// the report has fatal errors or it encounters other problems translating,
// an error is returned.
func (c Config) ToIgn3_5(options common.TranslateOptions) (types.Config, report.Report, error) {
cfg, r, err := cutil.Translate(c, "ToIgn3_5Unvalidated", options)
func (c Config) ToIgn3_6(options common.TranslateOptions) (types.Config, report.Report, error) {
cfg, r, err := cutil.Translate(c, "ToIgn3_6Unvalidated", options)
return cfg.(types.Config), r, err
}

Expand All @@ -208,7 +208,7 @@ func (c Config) ToIgn3_5(options common.TranslateOptions) (types.Config, report.
// translating, an error is returned.
func ToConfigBytes(input []byte, options common.TranslateBytesOptions) ([]byte, report.Report, error) {
if options.Raw {
return cutil.TranslateBytes(input, &Config{}, "ToIgn3_5", options)
return cutil.TranslateBytes(input, &Config{}, "ToIgn3_6", options)
} else {
return cutil.TranslateBytesYAML(input, &Config{}, "ToMachineConfig4_18", options)
}
Expand Down
Loading

0 comments on commit 9216cc6

Please sign in to comment.