Skip to content

Commit

Permalink
🐛 fixes users.all(sshkeys == empty) (#3713)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-rock authored Apr 5, 2024
1 parent f29dd1f commit 3093442
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions providers/os/resources/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func (u *mqlUser) sshkeys() ([]interface{}, error) {
// iterate over files and check if the content is there
for i := range potentialPrivateKeyFiles {
path := potentialPrivateKeyFiles[i]
data, err := os.ReadFile(path)
data, err := afutil.ReadFile(path)
if err != nil {
return nil, err
}
Expand All @@ -242,7 +242,8 @@ func (u *mqlUser) sshkeys() ([]interface{}, error) {
isEncrypted := strings.Contains(content, "ENCRYPTED")

if isPrivateKey {
upk, err := CreateResource(u.MqlRuntime, "privatekey", map[string]*llx.RawData{
// NOTE: we use new instead of create so that the file resource is properly initialized
upk, err := NewResource(u.MqlRuntime, "privatekey", map[string]*llx.RawData{
"pem": llx.StringData(content),
"encrypted": llx.BoolData(isEncrypted),
"path": llx.StringData(path),
Expand Down

0 comments on commit 3093442

Please sign in to comment.