mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-08 04:22:53 +00:00
Make Persistatant grub vars respect existing ones
We were basically overwriting the file if it existed which is bad. Now it will read the file if it exists and ingest the existing ones, then in will override witht he given vars if they match, warn the user and then store the full processed vars. This means it will never overwrite any vars again Signed-off-by: Itxaka <itxaka@kairos.io>
This commit is contained in:
@@ -804,9 +804,9 @@ var _ = Describe("Utils", Label("utils"), func() {
|
||||
defer os.Remove(temp.Name())
|
||||
Expect(utils.SetPersistentVariables(
|
||||
temp.Name(), map[string]string{"key1": "value1", "key2": "value2"},
|
||||
config.Fs,
|
||||
config,
|
||||
)).To(BeNil())
|
||||
readVars, err := utils.ReadPersistentVariables(temp.Name(), config.Fs)
|
||||
readVars, err := utils.ReadPersistentVariables(temp.Name(), config)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(readVars["key1"]).To(Equal("value1"))
|
||||
Expect(readVars["key2"]).To(Equal("value2"))
|
||||
@@ -814,7 +814,7 @@ var _ = Describe("Utils", Label("utils"), func() {
|
||||
It("Fails setting variables", func() {
|
||||
e := utils.SetPersistentVariables(
|
||||
"badfilenopath", map[string]string{"key1": "value1"},
|
||||
config.Fs,
|
||||
config,
|
||||
)
|
||||
Expect(e).NotTo(BeNil())
|
||||
})
|
||||
|
Reference in New Issue
Block a user