Skip to content

Commit 7548bf8

Browse files
authored
Merge pull request #203 from marquiz/devel/plugin-names-2
plugins: drop -name flag from most of the plugins
2 parents 8c53e55 + ab267c2 commit 7548bf8

File tree

7 files changed

+16
-49
lines changed

7 files changed

+16
-49
lines changed

plugins/device-injector/device-injector.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -413,25 +413,20 @@ func dump(args ...interface{}) {
413413

414414
func main() {
415415
var (
416-
pluginName string
417-
pluginIdx string
418-
opts []stub.Option
419-
err error
416+
pluginIdx string
417+
opts []stub.Option
418+
err error
420419
)
421420

422421
log = logrus.StandardLogger()
423422
log.SetFormatter(&logrus.TextFormatter{
424423
PadLevelText: true,
425424
})
426425

427-
flag.StringVar(&pluginName, "name", "", "plugin name to register to NRI")
428426
flag.StringVar(&pluginIdx, "idx", "", "plugin index to register to NRI")
429427
flag.BoolVar(&verbose, "verbose", false, "enable (more) verbose logging")
430428
flag.Parse()
431429

432-
if pluginName != "" {
433-
opts = append(opts, stub.WithPluginName(pluginName))
434-
}
435430
if pluginIdx != "" {
436431
opts = append(opts, stub.WithPluginIdx(pluginIdx))
437432
}

plugins/differ/nri-differ.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ func (p *plugin) printYamlDiff(apifunc string, obj string, origValue interface{}
339339
}
340340
}
341341

342-
func startPlugin(wg *sync.WaitGroup, pluginName string, pluginIdx int) {
342+
func startPlugin(wg *sync.WaitGroup, pluginIdx int) {
343343
var (
344344
opts []stub.Option
345345
err error
@@ -349,9 +349,6 @@ func startPlugin(wg *sync.WaitGroup, pluginName string, pluginIdx int) {
349349

350350
idxStr := fmt.Sprintf("%02d", pluginIdx)
351351

352-
if pluginName != "" {
353-
opts = append(opts, stub.WithPluginName(pluginName))
354-
}
355352
if idxStr != "" {
356353
opts = append(opts, stub.WithPluginIdx(idxStr))
357354
}
@@ -434,7 +431,7 @@ func main() {
434431

435432
wg.Add(1)
436433

437-
go startPlugin(wg, "Differ", idx)
434+
go startPlugin(wg, idx)
438435
}
439436

440437
entry := indices[prevIndex]

plugins/hook-injector/hook-injector.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ func dump(args ...interface{}) {
135135

136136
func main() {
137137
var (
138-
pluginName string
139138
pluginIdx string
140139
disableWatch bool
141140
opts []stub.Option
@@ -148,15 +147,11 @@ func main() {
148147
PadLevelText: true,
149148
})
150149

151-
flag.StringVar(&pluginName, "name", "", "plugin name to register to NRI")
152150
flag.StringVar(&pluginIdx, "idx", "", "plugin index to register to NRI")
153151
flag.BoolVar(&verbose, "verbose", false, "enable (more) verbose logging")
154152
flag.BoolVar(&disableWatch, "disableWatch", false, "disable watching hook directories for new hooks")
155153
flag.Parse()
156154

157-
if pluginName != "" {
158-
opts = append(opts, stub.WithPluginName(pluginName))
159-
}
160155
if pluginIdx != "" {
161156
opts = append(opts, stub.WithPluginIdx(pluginIdx))
162157
}

plugins/logger/nri-logger.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,17 @@ func dump(args ...interface{}) {
216216

217217
func main() {
218218
var (
219-
pluginName string
220-
pluginIdx string
221-
events string
222-
opts []stub.Option
223-
err error
219+
pluginIdx string
220+
events string
221+
opts []stub.Option
222+
err error
224223
)
225224

226225
log = logrus.StandardLogger()
227226
log.SetFormatter(&logrus.TextFormatter{
228227
PadLevelText: true,
229228
})
230229

231-
flag.StringVar(&pluginName, "name", "", "plugin name to register to NRI")
232230
flag.StringVar(&pluginIdx, "idx", "", "plugin index to register to NRI")
233231
flag.StringVar(&events, "events", "all", "comma-separated list of events to subscribe for")
234232
flag.StringVar(&cfg.LogFile, "log-file", "", "logfile name, if logging to a file")
@@ -246,9 +244,6 @@ func main() {
246244
log.SetOutput(f)
247245
}
248246

249-
if pluginName != "" {
250-
opts = append(opts, stub.WithPluginName(pluginName))
251-
}
252247
if pluginIdx != "" {
253248
opts = append(opts, stub.WithPluginIdx(pluginIdx))
254249
}

plugins/network-device-injector/network-device-injector.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,25 +273,20 @@ func dump(args ...interface{}) {
273273

274274
func main() {
275275
var (
276-
pluginName string
277-
pluginIdx string
278-
opts []stub.Option
279-
err error
276+
pluginIdx string
277+
opts []stub.Option
278+
err error
280279
)
281280

282281
log = logrus.StandardLogger()
283282
log.SetFormatter(&logrus.TextFormatter{
284283
PadLevelText: true,
285284
})
286285

287-
flag.StringVar(&pluginName, "name", "", "plugin name to register to NRI")
288286
flag.StringVar(&pluginIdx, "idx", "", "plugin index to register to NRI")
289287
flag.BoolVar(&verbose, "verbose", false, "enable (more) verbose logging")
290288
flag.Parse()
291289

292-
if pluginName != "" {
293-
opts = append(opts, stub.WithPluginName(pluginName))
294-
}
295290
if pluginIdx != "" {
296291
opts = append(opts, stub.WithPluginIdx(pluginIdx))
297292
}

plugins/network-logger/plugin.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,22 @@ func (p *plugin) onClose() {
8383

8484
func main() {
8585
var (
86-
pluginName string
87-
pluginIdx string
88-
err error
86+
pluginIdx string
87+
err error
8988
)
9089

9190
log = logrus.StandardLogger()
9291
log.SetFormatter(&logrus.TextFormatter{
9392
PadLevelText: true,
9493
})
9594

96-
flag.StringVar(&pluginName, "network-logger", "", "plugin name to register to NRI")
9795
flag.StringVar(&pluginIdx, "idx", "", "plugin index to register to NRI")
9896
flag.Parse()
9997

10098
p := &plugin{}
10199
opts := []stub.Option{
102100
stub.WithOnClose(p.onClose),
103101
}
104-
if pluginName != "" {
105-
opts = append(opts, stub.WithPluginName(pluginName))
106-
}
107102
if pluginIdx != "" {
108103
opts = append(opts, stub.WithPluginIdx(pluginIdx))
109104
}

plugins/v010-adapter/v010-adapter.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,27 +195,22 @@ func namespacesToSlice(namespaces []*api.LinuxNamespace) []oci.LinuxNamespace {
195195

196196
func main() {
197197
var (
198-
pluginName string
199-
pluginIdx string
200-
err error
198+
pluginIdx string
199+
err error
201200
)
202201

203202
log = logrus.StandardLogger()
204203
log.SetFormatter(&logrus.TextFormatter{
205204
PadLevelText: true,
206205
})
207206

208-
flag.StringVar(&pluginName, "name", "", "plugin name to register to NRI")
209207
flag.StringVar(&pluginIdx, "idx", "", "plugin index to register to NRI")
210208
flag.Parse()
211209

212210
p := &plugin{}
213211
opts := []stub.Option{
214212
stub.WithOnClose(p.onClose),
215213
}
216-
if pluginName != "" {
217-
opts = append(opts, stub.WithPluginName(pluginName))
218-
}
219214
if pluginIdx != "" {
220215
opts = append(opts, stub.WithPluginIdx(pluginIdx))
221216
}

0 commit comments

Comments
 (0)