Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"io/fs"
"io/ioutil"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -106,18 +105,17 @@ func addVarsFromFile(currentVars map[string]string, path string) error {
// Group or Host doesn't exist in the inventory, ignoring
return nil
}
ext := filepath.Ext(path)
if ext != ".yaml" && ext != ".yml" {
return nil
}
f, err := ioutil.ReadFile(path)
f, err := os.ReadFile(path)
if err != nil {
return err
}
vars := make(map[string]interface{})
err = yaml.Unmarshal(f, &vars)
if err != nil {
return err
// XXX: file extensions dont matter in ansible, but if we cannot parse a file, its not a valid file
// dont return an error here so we can continue to walk
// should this parsing error really stop us from parsing more potential files?
return nil
}
for k, v := range vars {
switch v := v.(type) {
Expand Down