summaryrefslogtreecommitdiff
path: root/pkg/trust/policy.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-09-21 16:12:25 +0200
committerGitHub <noreply@github.com>2022-09-21 16:12:25 +0200
commit12655484e39eadbc0fa0607542aa4a49a21013a1 (patch)
tree9690fd321a567f302c0fc2d46854b00316af3957 /pkg/trust/policy.go
parenta4399ef813840b48fc027edc3d0bdedf8a038f23 (diff)
parentd968f3fe09a4c7d74464cfe2eaa9e4febbe61ba5 (diff)
downloadpodman-12655484e39eadbc0fa0607542aa4a49a21013a1.tar.gz
podman-12655484e39eadbc0fa0607542aa4a49a21013a1.tar.bz2
podman-12655484e39eadbc0fa0607542aa4a49a21013a1.zip
Merge pull request #15871 from cevich/replace_ioutil
Replace deprecated ioutil
Diffstat (limited to 'pkg/trust/policy.go')
-rw-r--r--pkg/trust/policy.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/pkg/trust/policy.go b/pkg/trust/policy.go
index d746e78cf..e0c5e0689 100644
--- a/pkg/trust/policy.go
+++ b/pkg/trust/policy.go
@@ -7,7 +7,6 @@ import (
"encoding/json"
"errors"
"fmt"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -72,7 +71,7 @@ type gpgIDReader func(string) []string
// createTmpFile creates a temp file under dir and writes the content into it
func createTmpFile(dir, pattern string, content []byte) (string, error) {
- tmpfile, err := ioutil.TempFile(dir, pattern)
+ tmpfile, err := os.CreateTemp(dir, pattern)
if err != nil {
return "", err
}
@@ -133,7 +132,7 @@ func parseUids(colonDelimitKeys []byte) []string {
// getPolicy parses policy.json into policyContent.
func getPolicy(policyPath string) (policyContent, error) {
var policyContentStruct policyContent
- policyContent, err := ioutil.ReadFile(policyPath)
+ policyContent, err := os.ReadFile(policyPath)
if err != nil {
return policyContentStruct, fmt.Errorf("unable to read policy file: %w", err)
}
@@ -207,7 +206,7 @@ func AddPolicyEntries(policyPath string, input AddPolicyEntriesInput) error {
_, err = os.Stat(policyPath)
if !os.IsNotExist(err) {
- policyContent, err := ioutil.ReadFile(policyPath)
+ policyContent, err := os.ReadFile(policyPath)
if err != nil {
return err
}
@@ -244,5 +243,5 @@ func AddPolicyEntries(policyPath string, input AddPolicyEntriesInput) error {
if err != nil {
return fmt.Errorf("setting trust policy: %w", err)
}
- return ioutil.WriteFile(policyPath, data, 0644)
+ return os.WriteFile(policyPath, data, 0644)
}