mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-16 06:29:46 +00:00
gear: Extract netboot artifacts
This changeset also adds a `config_url` and `options` keyword in the c3os config. Along with that the config logic is changed so the configuration is taken also from boot commands and merged in the final installed config file.
This commit is contained in:
committed by
Itxaka
parent
0310996d7f
commit
2e86e483a7
@@ -30,9 +30,9 @@ var _ = Describe("Get config", func() {
|
||||
Context("directory", func() {
|
||||
It("reads config file greedly", func() {
|
||||
|
||||
var cc string = `
|
||||
var cc string = `baz: bar
|
||||
c3os:
|
||||
network_token: "foo"
|
||||
network_token: foo
|
||||
`
|
||||
d, _ := ioutil.TempDir("", "xxxx")
|
||||
defer os.RemoveAll(d)
|
||||
@@ -44,7 +44,7 @@ fooz:
|
||||
`), os.ModePerm)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
c, err := Scan(d)
|
||||
c, err := Scan(Directories(d))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(c).ToNot(BeNil())
|
||||
Expect(c.C3OS.NetworkToken).To(Equal("foo"))
|
||||
@@ -86,5 +86,30 @@ fooz:
|
||||
"bb": map[interface{}]interface{}{"nothing": "foo"},
|
||||
}))
|
||||
})
|
||||
|
||||
It("merges with bootargs", func() {
|
||||
|
||||
var cc string = `
|
||||
c3os:
|
||||
network_token: "foo"
|
||||
|
||||
bb:
|
||||
nothing: "foo"
|
||||
`
|
||||
d, _ := ioutil.TempDir("", "xxxx")
|
||||
defer os.RemoveAll(d)
|
||||
|
||||
err := ioutil.WriteFile(filepath.Join(d, "test"), []byte(cc), os.ModePerm)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = ioutil.WriteFile(filepath.Join(d, "b"), []byte(`zz.foo="baa" options.foo=bar`), os.ModePerm)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
c, err := Scan(Directories(d), MergeBootLine, WithBootCMDLineFile(filepath.Join(d, "b")))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(c.Options["foo"]).To(Equal("bar"))
|
||||
Expect(c.C3OS.NetworkToken).To(Equal("foo"))
|
||||
_, exists := c.Data()["zz"]
|
||||
Expect(exists).To(BeFalse())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user