Created
January 14, 2016 23:33
-
-
Save misterdorm/c77ee64c9435e232053c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.nova_get_host_by_name_and_type(host_name, service_type) | |
#find the host by name and service type | |
nova_hosts.each do |entry| | |
# (mdorman) Support api!cell_name@host_name -style output of nova host-list under nova cells | |
if entry["host_name"] =~ /^([a-zA-Z0-1\-_]+![a-zA-Z0-1\-_]+@)?#{Regexp.quote(host_name)}$/ | |
if entry["service"] == service_type | |
return host_name | |
end | |
end | |
end | |
#name/service combo not found | |
return nil | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment