Skip to content

Commit

Permalink
Refact name of autheticated client
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Feb 23, 2024
1 parent 3154599 commit 66974eb
Show file tree
Hide file tree
Showing 33 changed files with 149 additions and 125 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ require (
github.com/tsuru/go-tsuruclient v0.0.0-20231124151049-7b8d8ea2ee30
github.com/tsuru/tablecli v0.0.0-20190131152944-7ded8a3383c6
github.com/tsuru/tsuru v0.0.0-20240220172434-1ffd178d4e76
golang.org/x/net v0.20.0
golang.org/x/oauth2 v0.16.0
golang.org/x/sys v0.16.0
golang.org/x/term v0.16.0
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
gopkg.in/yaml.v2 v2.4.0
k8s.io/apimachinery v0.26.2
Expand Down Expand Up @@ -71,8 +73,6 @@ require (
github.com/tsuru/config v0.0.0-20201023175036-375aaee8b560 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.6.0 // indirect
Expand Down
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn
github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600=
github.com/Microsoft/hcsshim v0.8.18/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4=
github.com/Microsoft/hcsshim v0.9.6 h1:VwnDOgLeoi2du6dAznfmspNqTiwczvjv4K7NxuY9jsY=
github.com/Microsoft/hcsshim v0.9.6/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc=
github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU=
github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
Expand Down Expand Up @@ -161,6 +162,7 @@ github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR
github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ=
github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM=
github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg=
github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM=
github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=
github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=
github.com/containerd/fifo v0.0.0-20200410184934-f15a3290365b/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0=
Expand Down Expand Up @@ -359,6 +361,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
Expand Down Expand Up @@ -411,6 +414,7 @@ github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ
github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
Expand Down Expand Up @@ -603,6 +607,7 @@ github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJf
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
Expand Down Expand Up @@ -657,13 +662,15 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tsuru/commandmocker v0.0.0-20160909010208-e1d28f4f616a h1:Z9AGmLYCqZ+o7I/9UqvCF6Tj0DcUv72Hl7CTJ+ONDV4=
github.com/tsuru/commandmocker v0.0.0-20160909010208-e1d28f4f616a/go.mod h1:qIgHCNEogDodrCcRfLe4eWSgm3i5tH++2A8DfoO7gxQ=
github.com/tsuru/config v0.0.0-20201023175036-375aaee8b560 h1:fniQ/BmYAHdnNmY333kX4RdVBY+WDAOOs78VEunpY14=
github.com/tsuru/config v0.0.0-20201023175036-375aaee8b560/go.mod h1:mj6t8JKWU51GScTT50XRmDj65T5XhTyNvO5FUNV5zS4=
github.com/tsuru/gnuflag v0.0.0-20151217162021-86b8c1b864aa h1:JlLQP1xa13a994p/Aau2e3K9xXYaHNoNvTDVIMHSUa4=
Expand Down Expand Up @@ -810,6 +817,7 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -1030,6 +1038,7 @@ gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKW
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce h1:xcEWjVhvbDy+nHP67nPDDpbYrY+ILlfndk4bRioVHaU=
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
Expand All @@ -1047,6 +1056,7 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
Expand Down
2 changes: 1 addition & 1 deletion tsuru/admin/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (c *AppRoutesRebuild) Run(ctx *cmd.Context) error {
if err != nil {
return err
}
rsp, err := tsuruHTTP.DefaultClient.Do(request)
rsp, err := tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions tsuru/admin/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *EventBlockList) Run(context *cmd.Context) error {
return err
}
request, _ := http.NewRequest("GET", url, nil)
resp, err := tsuruHTTP.DefaultClient.Do(request)
resp, err := tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down Expand Up @@ -208,7 +208,7 @@ func (c *EventBlockRemove) Run(context *cmd.Context) error {
return err
}
request, _ := http.NewRequest(http.MethodDelete, url, nil)
_, err = tsuruHTTP.DefaultClient.Do(request)
_, err = tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions tsuru/admin/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (c *PlanCreate) Run(context *cmd.Context) error {
return err
}
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
_, err = tsuruHTTP.DefaultClient.Do(request)
_, err = tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
fmt.Fprintf(context.Stdout, "Failed to create plan!\n")
return err
Expand Down Expand Up @@ -113,7 +113,7 @@ func (c *PlanRemove) Run(context *cmd.Context) error {
if err != nil {
return err
}
_, err = tsuruHTTP.DefaultClient.Do(request)
_, err = tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
fmt.Fprintf(context.Stdout, "Failed to remove plan!\n")
return err
Expand Down
8 changes: 4 additions & 4 deletions tsuru/admin/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (p *PlatformList) Run(context *cmd.Context) error {
return err
}
var platforms []platform
resp, err := tsuruHTTP.DefaultClient.Do(request)
resp, err := tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down Expand Up @@ -154,7 +154,7 @@ func (p *PlatformAdd) Run(context *cmd.Context) error {
return err
}
request.Header.Add("Content-Type", writer.FormDataContentType())
response, err := tsuruHTTP.DefaultClient.Do(request)
response, err := tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down Expand Up @@ -251,7 +251,7 @@ func (p *PlatformUpdate) Run(context *cmd.Context) error {
return err
}
request.Header.Add("Content-Type", writer.FormDataContentType())
response, err := tsuruHTTP.DefaultClient.Do(request)
response, err := tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down Expand Up @@ -286,7 +286,7 @@ func (p *PlatformRemove) Run(context *cmd.Context) error {
if err != nil {
return err
}
_, err = tsuruHTTP.DefaultClient.Do(request)
_, err = tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
fmt.Fprintf(context.Stdout, "Failed to remove platform!\n")
return err
Expand Down
10 changes: 5 additions & 5 deletions tsuru/admin/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func (c *RemovePoolFromSchedulerCmd) Run(ctx *cmd.Context) error {
if err != nil {
return err
}
_, err = tsuruHTTP.DefaultClient.Do(req)
_, err = tsuruHTTP.AuthenticatedClient.Do(req)
if err != nil {
return err
}
Expand Down Expand Up @@ -309,7 +309,7 @@ func (AddTeamsToPoolCmd) Run(ctx *cmd.Context) error {
return err
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
_, err = tsuruHTTP.DefaultClient.Do(req)
_, err = tsuruHTTP.AuthenticatedClient.Do(req)
if err != nil {
return err
}
Expand Down Expand Up @@ -342,7 +342,7 @@ func (RemoveTeamsFromPoolCmd) Run(ctx *cmd.Context) error {
if err != nil {
return err
}
_, err = tsuruHTTP.DefaultClient.Do(req)
_, err = tsuruHTTP.AuthenticatedClient.Do(req)
if err != nil {
return err
}
Expand Down Expand Up @@ -379,7 +379,7 @@ func doRequest(url, method string, body []byte) error {
return err
}
req.Header.Set("Content-Type", "application/json")
_, err = tsuruHTTP.DefaultClient.Do(req)
_, err = tsuruHTTP.AuthenticatedClient.Do(req)
return err
}

Expand Down Expand Up @@ -419,7 +419,7 @@ func (c *PoolConstraintList) Run(ctx *cmd.Context) error {
if err != nil {
return err
}
resp, err := tsuruHTTP.DefaultClient.Do(req)
resp, err := tsuruHTTP.AuthenticatedClient.Do(req)
if err != nil {
return err
}
Expand Down
12 changes: 6 additions & 6 deletions tsuru/admin/quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (*UserQuotaView) Run(context *cmd.Context) error {
return err
}
request, _ := http.NewRequest("GET", url, nil)
resp, err := tsuruHTTP.DefaultClient.Do(request)
resp, err := tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down Expand Up @@ -81,7 +81,7 @@ func (*UserChangeQuota) Run(context *cmd.Context) error {
v.Set("limit", limit)
request, _ := http.NewRequest("PUT", u, bytes.NewBufferString(v.Encode()))
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
_, err = tsuruHTTP.DefaultClient.Do(request)
_, err = tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down Expand Up @@ -126,7 +126,7 @@ func (c *AppQuotaView) Run(context *cmd.Context) error {
return err
}
request, _ := http.NewRequest("GET", url, nil)
resp, err := tsuruHTTP.DefaultClient.Do(request)
resp, err := tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down Expand Up @@ -180,7 +180,7 @@ func (c *AppQuotaChange) Run(context *cmd.Context) error {
v.Set("limit", limit)
request, _ := http.NewRequest("PUT", u, bytes.NewBufferString(v.Encode()))
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
_, err = tsuruHTTP.DefaultClient.Do(request)
_, err = tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand All @@ -205,7 +205,7 @@ func (*TeamQuotaView) Run(context *cmd.Context) error {
return err
}
request, _ := http.NewRequest("GET", url, nil)
resp, err := tsuruHTTP.DefaultClient.Do(request)
resp, err := tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down Expand Up @@ -247,7 +247,7 @@ func (*TeamChangeQuota) Run(context *cmd.Context) error {
v.Set("limit", limit)
request, _ := http.NewRequest("PUT", u, bytes.NewBufferString(v.Encode()))
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
_, err = tsuruHTTP.DefaultClient.Do(request)
_, err = tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down
10 changes: 5 additions & 5 deletions tsuru/admin/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (c *ServiceCreate) Run(context *cmd.Context) error {
return err
}
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
_, err = tsuruHTTP.DefaultClient.Do(request)
_, err = tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand All @@ -101,7 +101,7 @@ func (c *ServiceDestroy) Run(context *cmd.Context) error {
if err != nil {
return err
}
_, err = tsuruHTTP.DefaultClient.Do(request)
_, err = tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down Expand Up @@ -156,7 +156,7 @@ func (c *ServiceUpdate) Run(ctx *cmd.Context) error {
return err
}
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, err := tsuruHTTP.DefaultClient.Do(request)
resp, err := tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down Expand Up @@ -195,7 +195,7 @@ func (c *ServiceDocAdd) Run(ctx *cmd.Context) error {
return err
}
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
_, err = tsuruHTTP.DefaultClient.Do(request)
_, err = tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand All @@ -215,7 +215,7 @@ func (c *ServiceDocGet) Run(ctx *cmd.Context) error {
if err != nil {
return err
}
resp, err := tsuruHTTP.DefaultClient.Do(request)
resp, err := tsuruHTTP.AuthenticatedClient.Do(request)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions tsuru/admin/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ func (s *S) SetUpTest(c *check.C) {

func (s *S) TearDownTest(c *check.C) {
formatter.LocalTZ = &s.defaultLocation
tsuruHTTP.DefaultClient = &http.Client{}
tsuruHTTP.AuthenticatedClient = &http.Client{}
}

func (s *S) setupFakeTransport(rt http.RoundTripper) {
tsuruHTTP.DefaultClient = tsuruHTTP.NewTerminalClient(rt, nil, "test", "0.1.0", 0)
tsuruHTTP.AuthenticatedClient = tsuruHTTP.NewTerminalClient(rt, nil, "test", "0.1.0", 0)
}

var _ = check.Suite(&S{})
Expand Down
9 changes: 9 additions & 0 deletions tsuru/auth/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,12 @@ func open(url string) error {
}
return executor().Execute(opts)
}

var execut exec.Executor

func executor() exec.Executor {
if execut == nil {
execut = exec.OsExecutor{}
}
return execut
}
9 changes: 9 additions & 0 deletions tsuru/auth/open_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@ func open(url string) error {
}
return executor().Execute(opts)
}

var execut exec.Executor

func executor() exec.Executor {
if execut == nil {
execut = exec.OsExecutor{}
}
return execut
}
Loading

0 comments on commit 66974eb

Please sign in to comment.