Skip to content

Commit

Permalink
Preserve pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvargo committed Mar 10, 2016
1 parent bbb45c4 commit 780c58d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions vault/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,19 @@ func Parse(rules string) (*Policy, error) {
}

// Create the initial policy and store the raw text of the rules
p := &Policy{Raw: rules}
var p Policy
p.Raw = rules
if err := hcl.DecodeObject(&p, list); err != nil {
return nil, fmt.Errorf("Failed to parse policy: %s", err)
}

if o := list.Filter("path"); len(o.Items) > 0 {
if err := parsePaths(p, o); err != nil {
if err := parsePaths(&p, o); err != nil {
return nil, fmt.Errorf("Failed to parse policy: %s", err)
}
}

return p, nil
return &p, nil
}

func parsePaths(result *Policy, list *ast.ObjectList) error {
Expand Down

0 comments on commit 780c58d

Please sign in to comment.