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

virtual check is wrong #6

Closed
blissend opened this issue Mar 8, 2019 · 2 comments
Closed

virtual check is wrong #6

blissend opened this issue Mar 8, 2019 · 2 comments

Comments

@blissend
Copy link

blissend commented Mar 8, 2019

The line on

if 'virtual' in node and node['virtual'] is not None:
is just checking for presence of virtual with value. This is wrong as shown in https://github.com/saltstack/salt/blob/659ec118ab21d1922d14013df7277d9f28c97678/salt/grains/core.py#L504 it by default has presence and physical as value that is returned. Multiple version of salt do the same including the latest. If this is not correct let me know.

Given the above, a potential solution is to just check if virtual doesn't have physical as value.

NOTE: Are there any unit tests done with this or provided with this?

@blissend
Copy link
Author

blissend commented Mar 8, 2019

Sample fix #7 properly marks inserted devices as physical type and rest as virtual. Subtypes not properly marked and it doesn't update types properly but those are preexisting issues.

@blissend
Copy link
Author

blissend commented Mar 8, 2019

Added another fix for virtual subtypes being wrong too. Salt puts the node['virtual'] value as type of virtual hosts (e.g. KVM/VMware/Hyper-v) but they can but not always have subtypes (chroot/docker/jail etc.). This script doesn't account for the value in node['virtual'] being the type of virtual host but it does now in #7. If there is a virtual_subtype I defined that as the virtual type for device42 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant