Tweak permissions on created files

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
pull/4380/head
Hidde Beydals 1 year ago
parent 1b239fbc82
commit e73d1acb20
No known key found for this signature in database
GPG Key ID: 979F380FC2341744

@ -182,7 +182,7 @@ func NewTestEnvKubeManager(testClusterMode TestClusterMode) (*testEnvKubeManager
}
tmpFilename := filepath.Join("/tmp", "kubeconfig-"+time.Nanosecond.String())
os.WriteFile(tmpFilename, kubeConfig, 0644)
os.WriteFile(tmpFilename, kubeConfig, 0o600)
k8sClient, err := client.NewWithWatch(cfg, client.Options{
Scheme: utils.NewScheme(),
})
@ -313,7 +313,7 @@ func assertGoldenTemplateFile(goldenFile string, templateValues map[string]strin
if len(templateValues) > 0 {
fmt.Println("NOTE: -update flag passed but golden template files can't be updated, please update it manually")
} else {
if err := os.WriteFile(goldenFile, []byte(output), 0644); err != nil {
if err := os.WriteFile(goldenFile, []byte(output), 0o600); err != nil {
return fmt.Errorf("failed to update golden file '%s': %v", goldenFile, err)
}
return nil

@ -168,13 +168,13 @@ func writeYamls(liveObject, mergedObject *unstructured.Unstructured) (string, st
liveYAML, _ := yaml.Marshal(liveObject)
liveFile := filepath.Join(tmpDir, "live.yaml")
if err := os.WriteFile(liveFile, liveYAML, 0644); err != nil {
if err := os.WriteFile(liveFile, liveYAML, 0o600); err != nil {
return "", "", "", err
}
mergedYAML, _ := yaml.Marshal(mergedObject)
mergedFile := filepath.Join(tmpDir, "merged.yaml")
if err := os.WriteFile(mergedFile, mergedYAML, 0644); err != nil {
if err := os.WriteFile(mergedFile, mergedYAML, 0o600); err != nil {
return "", "", "", err
}

@ -83,7 +83,7 @@ func installFlux(ctx context.Context, tmpDir string, kubeconfigPath string) erro
if err != nil {
return err
}
err = os.WriteFile(f.Name(), []byte(cfg.gitPrivateKey), 0o644)
err = os.WriteFile(f.Name(), []byte(cfg.gitPrivateKey), 0o600)
if err != nil {
return err
}

Loading…
Cancel
Save