Skip to content

Commit

Permalink
client,cmd,daemon: use "true" over than "yes" for bool args
Browse files Browse the repository at this point in the history
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
  • Loading branch information
zyga committed Jul 26, 2017
1 parent 30a17f9 commit 72fab62
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions client/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ func (client *Client) Interfaces(opts *InterfaceOptions) (interfaces []*Interfac
}
if opts != nil {
if opts.Doc {
query.Set("doc", "yes") // Return documentation of each selected interface.
query.Set("doc", "true") // Return documentation of each selected interface.
}
if opts.Plugs {
query.Set("plugs", "yes") // Return plugs of each selected interface.
query.Set("plugs", "true") // Return plugs of each selected interface.
}
if opts.Slots {
query.Set("slots", "yes") // Return slots of each selected interface.
query.Set("slots", "true") // Return slots of each selected interface.
}
}
// NOTE: Presence of "select" triggers the use of the new response format.
Expand Down
4 changes: 2 additions & 2 deletions client/interfaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (cs *clientSuite) TestClientInterfacesOptionEncoding(c *check.C) {
c.Check(cs.req.Method, check.Equals, "GET")
c.Check(cs.req.URL.Path, check.Equals, "/v2/interfaces")
c.Check(cs.req.URL.RawQuery, check.Equals,
"doc=yes&names=a%2Cb&plugs=yes&select=connected&slots=yes")
"doc=true&names=a%2Cb&plugs=true&select=connected&slots=true")
}

func (cs *clientSuite) TestClientInterfacesAll(c *check.C) {
Expand Down Expand Up @@ -122,7 +122,7 @@ func (cs *clientSuite) TestClientInterfacesSelectedDetails(c *check.C) {
// This enables documentation, plugs, slots, chooses a specific interface
// (iface-a), and uses select=all to indicate that new response is desired.
c.Check(cs.req.URL.RawQuery, check.Equals,
"doc=yes&names=iface-a&plugs=yes&select=all&slots=yes")
"doc=true&names=iface-a&plugs=true&select=all&slots=true")
c.Assert(err, check.IsNil)
c.Check(ifaces, check.DeepEquals, []*client.Interface{
{
Expand Down
4 changes: 2 additions & 2 deletions cmd/snap/cmd_interface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (s *SnapSuite) TestInterfaceDetails(c *C) {
s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) {
c.Check(r.Method, Equals, "GET")
c.Check(r.URL.Path, Equals, "/v2/interfaces")
c.Check(r.URL.RawQuery, Equals, "doc=yes&names=network&plugs=yes&select=all&slots=yes")
c.Check(r.URL.RawQuery, Equals, "doc=true&names=network&plugs=true&select=all&slots=true")
body, err := ioutil.ReadAll(r.Body)
c.Check(err, IsNil)
c.Check(body, DeepEquals, []byte{})
Expand Down Expand Up @@ -204,7 +204,7 @@ func (s *SnapSuite) TestInterfaceDetailsAndAttrs(c *C) {
s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) {
c.Check(r.Method, Equals, "GET")
c.Check(r.URL.Path, Equals, "/v2/interfaces")
c.Check(r.URL.RawQuery, Equals, "doc=yes&names=serial-port&plugs=yes&select=all&slots=yes")
c.Check(r.URL.RawQuery, Equals, "doc=true&names=serial-port&plugs=true&select=all&slots=true")
body, err := ioutil.ReadAll(r.Body)
c.Check(err, IsNil)
c.Check(body, DeepEquals, []byte{})
Expand Down
6 changes: 3 additions & 3 deletions daemon/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1614,9 +1614,9 @@ func getInterfaces(c *Command, r *http.Request, user *auth.UserState) Response {

opts := &interfaces.QueryOptions{
Names: names,
Doc: q.Get("doc") == "yes",
Plugs: q.Get("plugs") == "yes",
Slots: q.Get("slots") == "yes",
Doc: q.Get("doc") == "true",
Plugs: q.Get("plugs") == "true",
Slots: q.Get("slots") == "true",
Connected: pselect == "connected",
}
repo := c.d.overlord.InterfaceManager().Repository()
Expand Down

0 comments on commit 72fab62

Please sign in to comment.