Skip to content

Commit

Permalink
Remove queryOptions and writeOptions
Browse files Browse the repository at this point in the history
This mimics the default behavior of using the agent acl token if
a token is not specified.
  • Loading branch information
ChrisAubuchon committed Jun 18, 2015
1 parent d6524bd commit adef1f3
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 24 deletions.
4 changes: 1 addition & 3 deletions command/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package command
import (
"strings"

consulapi "github.com/hashicorp/consul/api"
"github.com/mitchellh/cli"
)

Expand Down Expand Up @@ -62,9 +61,8 @@ func (c *CloneCommand) Run(args []string) int {
return 1
}
client := consul.ACL()
writeOpts := new(consulapi.WriteOptions)

newid, _, err := client.Clone(id, writeOpts)
newid, _, err := client.Clone(id, nil)
if err != nil {
c.UI.Error(err.Error())
return 1
Expand Down
10 changes: 1 addition & 9 deletions command/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,12 @@ func (c *CreateCommand) Run(args []string) int {
return 1
}

// if len(c.ConfigRules) < 1 && !isManagement {
// c.UI.Error("Must supply an acl rule")
// c.UI.Error("")
// c.UI.Error(c.Help())
// return 1
// }

consul, err := NewConsulClient(c.Consul, &c.UI)
if err != nil {
c.UI.Error(err.Error())
return 1
}
client := consul.ACL()
writeOpts := new(consulapi.WriteOptions)

var entry *consulapi.ACLEntry

Expand All @@ -118,7 +110,7 @@ func (c *CreateCommand) Run(args []string) int {

}

id, _, err := client.Create(entry, writeOpts)
id, _, err := client.Create(entry, nil)
if err != nil {
c.UI.Error(err.Error())
return 1
Expand Down
5 changes: 1 addition & 4 deletions command/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package command
import (
"strings"

consulapi "github.com/hashicorp/consul/api"
"github.com/mitchellh/cli"
)

Expand Down Expand Up @@ -63,9 +62,7 @@ func (c *DestroyCommand) Run(args []string) int {
}
client := consul.ACL()

writeOpts := new(consulapi.WriteOptions)

_, err = client.Destroy(id, writeOpts)
_, err = client.Destroy(id, nil)
if err != nil {
c.UI.Error(err.Error())
return 1
Expand Down
4 changes: 1 addition & 3 deletions command/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"strings"

consulapi "github.com/hashicorp/consul/api"
"github.com/mitchellh/cli"
)

Expand Down Expand Up @@ -63,9 +62,8 @@ func (c *InfoCommand) Run(args []string) int {
return 1
}
client := consul.ACL()
queryOpts := new(consulapi.QueryOptions)

acl, _, err := client.Info(id, queryOpts)
acl, _, err := client.Info(id, nil)
if err != nil {
c.UI.Error(err.Error())
return 1
Expand Down
4 changes: 1 addition & 3 deletions command/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"strings"

consulapi "github.com/hashicorp/consul/api"
"github.com/mitchellh/cli"
)

Expand Down Expand Up @@ -48,15 +47,14 @@ func (c *ListCommand) Run(args []string) int {
return 1
}

queryOpts := new(consulapi.QueryOptions)
consul, err := NewConsulClient(c.Consul, &c.UI)
if err != nil {
c.UI.Error(err.Error())
return 1
}
client := consul.ACL()

acls, _, err := client.List(queryOpts)
acls, _, err := client.List(nil)
if err != nil {
c.UI.Error(err.Error())
return 1
Expand Down
3 changes: 1 addition & 2 deletions command/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func (c *UpdateCommand) Run(args []string) int {
return 1
}
client := consul.ACL()
writeOpts := new(consulapi.WriteOptions)

var entry *consulapi.ACLEntry

Expand All @@ -114,7 +113,7 @@ func (c *UpdateCommand) Run(args []string) int {

}

_, err = client.Update(entry, writeOpts)
_, err = client.Update(entry, nil)
if err != nil {
c.UI.Error(err.Error())
return 1
Expand Down

0 comments on commit adef1f3

Please sign in to comment.