Skip to content

Instantly share code, notes, and snippets.

@spheromak
Created March 22, 2013 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spheromak/5218256 to your computer and use it in GitHub Desktop.
Save spheromak/5218256 to your computer and use it in GitHub Desktop.
# Get the proper system type.
def system_class
virt = node.virtualization
if virt[:role]
if virt[:role] == "guest" && virt[:system] == "xen"
return "xen-guest"
elsif virt[:role] == "host" && virt[:system] == "xen"
return "xen-host"
else
return "unknown-vm"
end
else
return "hardware"
end
end
# Assert a system class against the nodes system class
def system_class?(arg)
return true ? arg == system_class : false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment