From f2f47d25326ff196d91297f1ad5f5abedc47ebba Mon Sep 17 00:00:00 2001 From: Loic Devulder Date: Fri, 6 Oct 2023 12:43:08 +0200 Subject: [PATCH] Disable local plan for elemental-system-agent As local plan is not used, only remote. Signed-off-by: Loic Devulder --- pkg/install/_testdata/system-agent-config.yaml | 2 +- pkg/install/install.go | 2 +- pkg/install/install_test.go | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/install/_testdata/system-agent-config.yaml b/pkg/install/_testdata/system-agent-config.yaml index e7acea5fe..2be5739ec 100644 --- a/pkg/install/_testdata/system-agent-config.yaml +++ b/pkg/install/_testdata/system-agent-config.yaml @@ -13,6 +13,6 @@ stages: permissions: 384 owner: 0 group: 0 - content: '{"workDirectory":"/var/lib/elemental/agent/work","localEnabled":true,"localPlanDirectory":"/var/lib/elemental/agent/plans","appliedPlanDirectory":"/var/lib/elemental/agent/applied","remoteEnabled":true,"connectionInfoFile":"/var/lib/elemental/agent/elemental_connection.json"}' + content: '{"workDirectory":"/var/lib/elemental/agent/work","localPlanDirectory":"/var/lib/elemental/agent/plans","appliedPlanDirectory":"/var/lib/elemental/agent/applied","remoteEnabled":true,"connectionInfoFile":"/var/lib/elemental/agent/elemental_connection.json"}' encoding: "" ownerstring: "" diff --git a/pkg/install/install.go b/pkg/install/install.go index 5e3785ee0..34e68236d 100644 --- a/pkg/install/install.go +++ b/pkg/install/install.go @@ -291,7 +291,7 @@ func (i *installer) getAgentConfigBytes() ([]byte, error) { AppliedPlanDir: filepath.Join(agentStateDir, "applied"), LocalPlanDir: filepath.Join(agentStateDir, "plans"), RemoteEnabled: true, - LocalEnabled: true, + LocalEnabled: false, ConnectionInfoFile: filepath.Join(agentStateDir, "elemental_connection.json"), PreserveWorkDir: false, } diff --git a/pkg/install/install_test.go b/pkg/install/install_test.go index 7ea2c904f..6b3a9b7c3 100644 --- a/pkg/install/install_test.go +++ b/pkg/install/install_test.go @@ -18,7 +18,6 @@ package install import ( "fmt" - "io/ioutil" "os" "testing" "time" @@ -148,7 +147,7 @@ var _ = Describe("installer reset elemental", Label("installer", "reset"), func( checkConfigs(fs) }) It("should remove reset plan", func() { - Expect(fs.WriteFile(controllers.LocalResetPlanPath, []byte("{}\n"), os.FileMode(600))).ToNot(HaveOccurred()) + Expect(fs.WriteFile(controllers.LocalResetPlanPath, []byte("{}\n"), os.FileMode(0600))).ToNot(HaveOccurred()) cliRunner.EXPECT().Reset(gomock.Any()).Return(nil) Expect(install.ResetElemental(configFixture, stateFixture)).ToNot(HaveOccurred()) _, err := fs.Stat(controllers.LocalResetPlanPath) @@ -176,7 +175,7 @@ func checkConfigs(fs vfs.FS) { func compareFiles(fs vfs.FS, got string, want string) { gotFile, err := fs.ReadFile(got) Expect(err).ToNot(HaveOccurred()) - wantFile, err := ioutil.ReadFile(want) + wantFile, err := os.ReadFile(want) Expect(err).ToNot(HaveOccurred()) Expect(string(gotFile)).To(Equal(string(wantFile))) }