mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-08-20 01:07:02 +00:00
bug: Process only cloud configs (#550)
Regression introduced in https://github.com/kairos-io/kairos/pull/502. Now also files like .lst inside the initramfs are globbed inside /oem/90_custom.yaml Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com> Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
This commit is contained in:
parent
3d92e4ae43
commit
2bf4793c41
@ -299,15 +299,19 @@ func parseConfig(dir []string) *Config {
|
|||||||
fmt.Printf("warning: skipping %s. too big (>1MB)\n", f)
|
fmt.Printf("warning: skipping %s. too big (>1MB)\n", f)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
b, err := os.ReadFile(f)
|
if strings.Contains(f, "userdata") || filepath.Ext(f) == ".yml" || filepath.Ext(f) == ".yaml" {
|
||||||
if err != nil {
|
b, err := os.ReadFile(f)
|
||||||
fmt.Printf("warning: skipping %s. %s\n", f, err.Error())
|
if err != nil {
|
||||||
continue
|
fmt.Printf("warning: skipping %s. %s\n", f, err.Error())
|
||||||
}
|
continue
|
||||||
yaml.Unmarshal(b, c) //nolint:errcheck
|
}
|
||||||
yaml.Unmarshal(b, &c.originalData) //nolint:errcheck
|
yaml.Unmarshal(b, c) //nolint:errcheck
|
||||||
if exists, header := HasHeader(string(b), ""); exists {
|
yaml.Unmarshal(b, &c.originalData) //nolint:errcheck
|
||||||
c.header = header
|
if exists, header := HasHeader(string(b), ""); exists {
|
||||||
|
c.header = header
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Printf("warning: skipping %s (extension).\n", f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,10 +71,10 @@ b: f
|
|||||||
c: d
|
c: d
|
||||||
`
|
`
|
||||||
|
|
||||||
err := os.WriteFile(filepath.Join(d, "test"), []byte(cc), os.ModePerm)
|
err := os.WriteFile(filepath.Join(d, "test.yaml"), []byte(cc), os.ModePerm)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
err = os.WriteFile(filepath.Join(d, "b"), []byte(c2), os.ModePerm)
|
err = os.WriteFile(filepath.Join(d, "b.yaml"), []byte(c2), os.ModePerm)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
c, err := Scan(Directories(d))
|
c, err := Scan(Directories(d))
|
||||||
@ -99,9 +99,9 @@ kairos:
|
|||||||
network_token: foo
|
network_token: foo
|
||||||
`
|
`
|
||||||
|
|
||||||
err := os.WriteFile(filepath.Join(d, "test"), []byte(cc), os.ModePerm)
|
err := os.WriteFile(filepath.Join(d, "test.yaml"), []byte(cc), os.ModePerm)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
err = os.WriteFile(filepath.Join(d, "b"), []byte(`
|
err = os.WriteFile(filepath.Join(d, "b.yaml"), []byte(`
|
||||||
fooz:
|
fooz:
|
||||||
`), os.ModePerm)
|
`), os.ModePerm)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -127,7 +127,7 @@ bb:
|
|||||||
nothing: "foo"
|
nothing: "foo"
|
||||||
`
|
`
|
||||||
|
|
||||||
err := os.WriteFile(filepath.Join(d, "test"), []byte(cc), os.ModePerm)
|
err := os.WriteFile(filepath.Join(d, "test.yaml"), []byte(cc), os.ModePerm)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
err = os.WriteFile(filepath.Join(d, "b"), []byte(`zz.foo="baa" options.foo=bar`), os.ModePerm)
|
err = os.WriteFile(filepath.Join(d, "b"), []byte(`zz.foo="baa" options.foo=bar`), os.ModePerm)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -151,7 +151,7 @@ bb:
|
|||||||
config_url: "https://gist.githubusercontent.com/mudler/ab26e8dd65c69c32ab292685741ca09c/raw/bafae390eae4e6382fb1b68293568696823b3103/test.yaml"
|
config_url: "https://gist.githubusercontent.com/mudler/ab26e8dd65c69c32ab292685741ca09c/raw/bafae390eae4e6382fb1b68293568696823b3103/test.yaml"
|
||||||
`
|
`
|
||||||
|
|
||||||
err := os.WriteFile(filepath.Join(d, "test"), []byte(cc), os.ModePerm)
|
err := os.WriteFile(filepath.Join(d, "test.yaml"), []byte(cc), os.ModePerm)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
c, err := Scan(Directories(d))
|
c, err := Scan(Directories(d))
|
||||||
@ -168,7 +168,7 @@ config_url: "https://gist.githubusercontent.com/mudler/ab26e8dd65c69c32ab2926857
|
|||||||
config_url: "https://gist.githubusercontent.com/mudler/7e3d0426fce8bfaaeb2644f83a9bfe0c/raw/77ded58aab3ee2a8d4117db95e078f81fd08dfde/testgist.yaml"
|
config_url: "https://gist.githubusercontent.com/mudler/7e3d0426fce8bfaaeb2644f83a9bfe0c/raw/77ded58aab3ee2a8d4117db95e078f81fd08dfde/testgist.yaml"
|
||||||
`
|
`
|
||||||
|
|
||||||
err := os.WriteFile(filepath.Join(d, "test"), []byte(cc), os.ModePerm)
|
err := os.WriteFile(filepath.Join(d, "test.yaml"), []byte(cc), os.ModePerm)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
c, err := Scan(Directories(d))
|
c, err := Scan(Directories(d))
|
||||||
|
Loading…
Reference in New Issue
Block a user