From 60484dbf7f6c28cbc19a26c4ef5cda94c031a233 Mon Sep 17 00:00:00 2001 From: John Gosset Date: Mon, 13 Nov 2023 05:44:40 -0500 Subject: [PATCH 1/2] fix(drivers/compose): Remove execute bit from generated file There's no need for a docker-compose file to be executable, so don't add the execute bit to the generated file. --- pkg/drivers/compose.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/drivers/compose.go b/pkg/drivers/compose.go index 944f2bd..b97b8d0 100644 --- a/pkg/drivers/compose.go +++ b/pkg/drivers/compose.go @@ -60,7 +60,7 @@ func (d *ComposeDriver) ApplyAll(stack *stack.Stack, stdout bool) error { os.MkdirAll(d.Config.Output.Dir, 0700) } filePath := path.Join(d.Config.Output.Dir, d.Config.Output.File) - os.WriteFile(filePath, data, 0700) + os.WriteFile(filePath, data, 0600) log.Infof("[compose] applied resources to \"%s\"", filePath) From 033acbb5a5198dc80b29e558a1e3d7c0f33e40ab Mon Sep 17 00:00:00 2001 From: John Gosset Date: Mon, 13 Nov 2023 05:50:29 -0500 Subject: [PATCH 2/2] fix(drivers/compose): Handle errors on dir/file creation --- pkg/drivers/compose.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/drivers/compose.go b/pkg/drivers/compose.go index b97b8d0..56bc40d 100644 --- a/pkg/drivers/compose.go +++ b/pkg/drivers/compose.go @@ -57,10 +57,14 @@ func (d *ComposeDriver) ApplyAll(stack *stack.Stack, stdout bool) error { } if _, err := os.Stat(d.Config.Output.Dir); os.IsNotExist(err) { - os.MkdirAll(d.Config.Output.Dir, 0700) + if err := os.MkdirAll(d.Config.Output.Dir, 0700); err != nil { + return err + } } filePath := path.Join(d.Config.Output.Dir, d.Config.Output.File) - os.WriteFile(filePath, data, 0600) + if err := os.WriteFile(filePath, data, 0600); err != nil { + return err + } log.Infof("[compose] applied resources to \"%s\"", filePath)