Skip to content

Commit

Permalink
remove extraneous debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
abtreece committed Sep 23, 2024
1 parent 4651088 commit 644be7c
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions pkg/backends/vault/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,10 @@ func (c *Client) GetValues(paths []string) (map[string]string, error) {
vars := make(map[string]string)
var mounts []string
for _, path := range paths {
log.Debug("Path: %+v", path)
path = strings.TrimRight(path, "/*")
mounts = append(mounts, getMount(path))
}
mounts = uniqMounts(mounts)
log.Debug("Mounts: %s", mounts)

for _, mount := range mounts {
resp, err := c.client.Logical().ReadRaw("/sys/internal/ui/mounts/" + mount)
Expand Down Expand Up @@ -210,9 +208,7 @@ func (c *Client) GetValues(paths []string) (map[string]string, error) {
switch version {
case "", "1":
for _, secret := range RecursiveListSecret(c.client, mount, key, version) {
log.Debug("%+v\n", secret)
resp, _ := c.client.Logical().Read(secret)
log.Debug("%s\n", resp.Data)

js, _ := json.Marshal(resp.Data)
vars[secret] = string(js)
Expand All @@ -221,7 +217,6 @@ func (c *Client) GetValues(paths []string) (map[string]string, error) {
case "2":
for _, secret := range RecursiveListSecret(c.client, mount, key, version) {
resp, _ := c.client.Logical().Read(secret)
log.Debug("%+v\n", resp.Data["data"])

js, _ := json.Marshal(resp.Data["data"])
vars[secret] = string(js)
Expand All @@ -240,7 +235,6 @@ func flatten(key string, value interface{}, mount string, vars map[string]string
switch value.(type) {
case string:
key = strings.ReplaceAll(key, "data/", "")
log.Debug("setting key %s to: %s", key, value)
vars[key] = value.(string)
case map[string]interface{}:
inner := value.(map[string]interface{})
Expand Down Expand Up @@ -280,15 +274,13 @@ func RecursiveListSecret(vault *vaultapi.Client, path string, key string, versio
case "1":
secretList, err := ListSecret(vault, path, key, version)
if err == nil && secretList != nil {
log.Debug("secretList: %+v\n", secretList)
for _, secret := range secretList.Data["keys"].([]interface{}) {
if strings.HasSuffix(secret.(string), "/") {
key := key + "/" + strings.TrimSuffix(secret.(string), "/")
RecursiveListSecret(vault, path, key, version)
} else {
key := key + "/" + strings.TrimSuffix(secret.(string), "/")
secretListPath = append([]string{path + key}, secretListPath...)
log.Debug("secretListPath: %s", secretListPath)
}
}
} else {
Expand All @@ -297,17 +289,14 @@ func RecursiveListSecret(vault *vaultapi.Client, path string, key string, versio
return secretListPath
case "2":
secretList, err := ListSecret(vault, path, key, version)
log.Debug("secretList: %+v", secretList)
if err == nil && secretList != nil {
for _, secret := range secretList.Data["keys"].([]interface{}) {
log.Debug("secret: %s", secret)
if strings.HasSuffix(secret.(string), "/") {
key := key + "/" + strings.TrimSuffix(secret.(string), "/")
RecursiveListSecret(vault, path, key, version)
} else {
key := key + "/" + strings.TrimSuffix(secret.(string), "/")
secretListPath = append([]string{path + "/data" + key}, secretListPath...)
log.Debug("secretListPath: %s", secretListPath)
}
}
} else {
Expand Down

0 comments on commit 644be7c

Please sign in to comment.