@@ -62,11 +62,6 @@ func getPluginName() (string, error) {
62
62
63
63
// createContainer builds the plugin and creates the container that will later become the rootfs used by the plugin
64
64
func createContainer (ctx context.Context , cli * client.Client ) error {
65
- goVersion , err := mage .GoVersion ()
66
- if err != nil {
67
- return errors .Wrap (err , "error determining go version" )
68
- }
69
-
70
65
dockerLogBeatDir , err := os .Getwd ()
71
66
if err != nil {
72
67
return errors .Wrap (err , "error getting work dir" )
@@ -96,7 +91,6 @@ func createContainer(ctx context.Context, cli *client.Client) error {
96
91
defer buildContext .Close ()
97
92
98
93
buildOpts := types.ImageBuildOptions {
99
- BuildArgs : map [string ]* string {"versionString" : & goVersion },
100
94
Tags : []string {rootImageName },
101
95
Dockerfile : "Dockerfile" ,
102
96
}
@@ -209,11 +203,6 @@ func cleanDockerArtifacts(ctx context.Context, containerID string, cli *client.C
209
203
210
204
// Uninstall removes working objects and containers
211
205
func Uninstall (ctx context.Context ) error {
212
- name , err := getPluginName ()
213
- if err != nil {
214
- return err
215
- }
216
-
217
206
cli , err := client .NewClientWithOpts (client .FromEnv )
218
207
if err != nil {
219
208
return errors .Wrap (err , "Error creating docker client" )
@@ -224,21 +213,25 @@ func Uninstall(ctx context.Context) error {
224
213
if err != nil {
225
214
return errors .Wrap (err , "error getting list of plugins" )
226
215
}
227
- oursExists := false
216
+
217
+ toRemoveName := ""
228
218
for _ , plugin := range plugins {
229
219
if strings .Contains (plugin .Name , logDriverName ) {
230
- oursExists = true
220
+ toRemoveName = plugin .Name
221
+ break
231
222
}
232
223
}
233
- if oursExists {
234
- err = cli .PluginDisable (ctx , name , types.PluginDisableOptions {Force : true })
235
- if err != nil {
236
- return errors .Wrap (err , "error disabling plugin" )
237
- }
238
- err = cli .PluginRemove (ctx , name , types.PluginRemoveOptions {Force : true })
239
- if err != nil {
240
- return errors .Wrap (err , "error removing plugin" )
241
- }
224
+ if toRemoveName == "" {
225
+ return nil
226
+ }
227
+
228
+ err = cli .PluginDisable (ctx , toRemoveName , types.PluginDisableOptions {Force : true })
229
+ if err != nil {
230
+ return errors .Wrap (err , "error disabling plugin" )
231
+ }
232
+ err = cli .PluginRemove (ctx , toRemoveName , types.PluginRemoveOptions {Force : true })
233
+ if err != nil {
234
+ return errors .Wrap (err , "error removing plugin" )
242
235
}
243
236
244
237
return nil
0 commit comments