From 5f834c7388edd87dea0c8035fccefd5beba0095b Mon Sep 17 00:00:00 2001 From: SebClem Date: Tue, 4 Jul 2023 17:54:42 +0200 Subject: [PATCH] Fix private key --- entrypoint.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/entrypoint.go b/entrypoint.go index 08f4086..254251c 100644 --- a/entrypoint.go +++ b/entrypoint.go @@ -4,6 +4,7 @@ import ( "os" "os/exec" "strconv" + "strings" "go.uber.org/zap" "go.uber.org/zap/zapcore" @@ -153,6 +154,9 @@ func main() { if pluginConfig.privateKey != nil { sugar.Info("🔑 Adding ssh key to .ssh/id_ed25519") os.MkdirAll("/root/.ssh", 0700) + if !strings.HasSuffix(*pluginConfig.privateKey, "\n") { + *pluginConfig.privateKey = *pluginConfig.privateKey + "\n" + } err := os.WriteFile("/root/.ssh/id_ed25519", []byte(*pluginConfig.privateKey), 0400) if err != nil { sugar.Fatal(err) @@ -214,7 +218,6 @@ func main() { args = append(args, "--tags", *pluginConfig.tags) } - // runCommand(sugar, "export", "ANSIBLE_HOST_KEY_CHECKING=False") command := append([]string{"ansible-playbook"}, args...) runCommand(sugar, command...) }