Skip to content

The plugin warns about incorrect OS type #126

Description

@drbolsen

Summary

Just got another bug, an error message:

  esxi-native:index:VirtualMachine (photonos-01):
    warning: One or more imported inputs failed to validate. This is almost certainly a bug in the `esxi-native` provider. The import will still proceed, but you will need to edit the generated code after copying it into your program.
    warning: esxi-native:index:VirtualMachine resource 'photonos-01': property esxi-native:index:VirtualMachine.os value {<nil>} has a problem: The property 'os' is invalid! The value should be from here: https://github.com/josenk/vagrant-vmware-esxi/wiki/VMware-ESXi-6.5-guestOS-types

The problem is the following function in validation.go

// validateVirtualMachineOsType checks if the OS type is valid.
func validateVirtualMachineOsType(os string) bool {
	//  All valid Guest OS's
	allGuestOSs := [...]string{

        ... skipped ...

       		"vmwarephoton",

       ... skipped ...

	}

	os = fmt.Sprintf("%s\n", strings.ToLower(os))
	for i := 0; i < len(allGuestOSs); i++ {
		if strings.Contains(os, allGuestOSs[i]) {
			return true
		}
	}
	return false
}

Since it is an exisiting VM, the VM that is up and running, the actual OS type is vmware-photon-64, not vmwarephoton, therefore string.Contains can't find a match and returns false.

Diagnostics

What version of the provider are you running?

The plugin version is 1.0.0


Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions