Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[inputs.vsphere] Panic if folder name matches name of item in folder and recursive wildcards are used #6235

Closed
prydin opened this issue Aug 9, 2019 · 0 comments · Fixed by #6245
Labels
area/vsphere bug unexpected problem or unintended behavior
Milestone

Comments

@prydin
Copy link
Contributor

prydin commented Aug 9, 2019

Version

Telegraf 1.11.7

Expected behavior:

This inventory path query for a VM should work even if a folder matches "F*": /F0/DC0/vm/**/F*

Actual behavior:

The folder is incorrectly added to the result set due to a missing type check. This subsequently causes the type coercion to the result type to fail with a panic as follows:

	panic: reflect.Set: value of type mo.Folder is not assignable to type mo.VirtualMachine

goroutine 36 [running]:
testing.tRunner.func1(0xc0002f4100)
	/usr/local/go/src/testing/testing.go:830 +0x392
panic(0x1927fe0, 0xc0000e1750)
	/usr/local/go/src/runtime/panic.go:522 +0x1b5
reflect.Value.assignTo(0x1b11860, 0xc000336b60, 0x99, 0x1b9171a, 0xb, 0x1b74c40, 0x0, 0x97, 0xc00042f980, 0x18ff960)
	/usr/local/go/src/reflect/value.go:2339 +0x437
reflect.Value.Set(0x1b74c40, 0xc000290800, 0x199, 0x1b11860, 0xc000336b60, 0x99)
	/usr/local/go/src/reflect/value.go:1473 +0xa8
reflect.Append(0x18ff960, 0xc0003525c0, 0x197, 0xc000443840, 0x1, 0x1, 0x0, 0x0, 0x0)
	/usr/local/go/src/reflect/value.go:1964 +0xe3
github.com/influxdata/telegraf/plugins/inputs/vsphere.objectContentToTypedArray(0xc0003cfa40, 0x18bd1e0, 0xc0003525c0, 0xc0000ee440, 0x6)
	/Users/prydin/go/src/github.com/influxdata/telegraf/plugins/inputs/vsphere/finder.go:206 +0x3d0
github.com/influxdata/telegraf/plugins/inputs/vsphere.(*Finder).Find(0xc0003cfe38, 0x1d2da80, 0xc0000ee000, 0x1b94838, 0xe, 0x1b9671b, 0x10, 0x18bd1e0, 0xc0003525c0, 0x0, ...)
	/Users/prydin/go/src/github.com/influxdata/telegraf/plugins/inputs/vsphere/finder.go:59 +0x354
github.com/influxdata/telegraf/plugins/inputs/vsphere.TestFolders(0xc0002f4100)
	/Users/prydin/go/src/github.com/influxdata/telegraf/plugins/inputs/vsphere/vsphere_test.go:454 +0x998
testing.tRunner(0xc0002f4100, 0x1be5808)
	/usr/local/go/src/testing/testing.go:865 +0xc0
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:916 +0x35a

Additional info:

Note that this ONLY happens when recursive wildcards (**) are used AND the path contains a folder that matches the same pattern as the wanted object.

@danielnelson danielnelson added area/vsphere bug unexpected problem or unintended behavior labels Aug 9, 2019
@danielnelson danielnelson added this to the 1.12.0 milestone Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/vsphere bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants