summaryrefslogtreecommitdiff
path: root/vendor/github.com/fsouza/go-dockerclient/plugin.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/fsouza/go-dockerclient/plugin.go')
-rw-r--r--vendor/github.com/fsouza/go-dockerclient/plugin.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/vendor/github.com/fsouza/go-dockerclient/plugin.go b/vendor/github.com/fsouza/go-dockerclient/plugin.go
index 957015907..088790313 100644
--- a/vendor/github.com/fsouza/go-dockerclient/plugin.go
+++ b/vendor/github.com/fsouza/go-dockerclient/plugin.go
@@ -40,10 +40,10 @@ func (c *Client) InstallPlugins(opts InstallPluginOptions) error {
data: opts.Plugins,
context: opts.Context,
})
- defer resp.Body.Close()
if err != nil {
return err
}
+ resp.Body.Close()
return nil
}
@@ -288,7 +288,6 @@ type EnablePluginOptions struct {
func (c *Client) EnablePlugin(opts EnablePluginOptions) error {
path := "/plugins/" + opts.Name + "/enable?" + queryString(opts)
resp, err := c.do("POST", path, doOptions{context: opts.Context})
- defer resp.Body.Close()
if err != nil {
return err
}
@@ -312,7 +311,6 @@ type DisablePluginOptions struct {
func (c *Client) DisablePlugin(opts DisablePluginOptions) error {
path := "/plugins/" + opts.Name + "/disable"
resp, err := c.do("POST", path, doOptions{context: opts.Context})
- defer resp.Body.Close()
if err != nil {
return err
}
@@ -339,11 +337,12 @@ func (c *Client) CreatePlugin(opts CreatePluginOptions) (string, error) {
path := "/plugins/create?" + queryString(opts)
resp, err := c.do("POST", path, doOptions{
data: opts.Path,
- context: opts.Context})
- defer resp.Body.Close()
+ context: opts.Context,
+ })
if err != nil {
return "", err
}
+ defer resp.Body.Close()
containerNameBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
@@ -367,10 +366,10 @@ type PushPluginOptions struct {
func (c *Client) PushPlugin(opts PushPluginOptions) error {
path := "/plugins/" + opts.Name + "/push"
resp, err := c.do("POST", path, doOptions{context: opts.Context})
- defer resp.Body.Close()
if err != nil {
return err
}
+ resp.Body.Close()
return nil
}
@@ -394,13 +393,13 @@ func (c *Client) ConfigurePlugin(opts ConfigurePluginOptions) error {
data: opts.Envs,
context: opts.Context,
})
- defer resp.Body.Close()
if err != nil {
if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound {
return &NoSuchPlugin{ID: opts.Name}
}
return err
}
+ resp.Body.Close()
return nil
}