Validate that all roles have hosts

This commit is contained in:
Jeremy Daer
2023-03-22 18:56:57 -07:00
parent 1887a6518e
commit 035e4afff7
3 changed files with 57 additions and 9 deletions

View File

@@ -7,6 +7,10 @@ class Mrsk::Configuration::Role
@name, @config = name.inquiry, config
end
def primary_host
hosts.first
end
def hosts
@hosts ||= extract_hosts_from_config
end
@@ -55,7 +59,7 @@ class Mrsk::Configuration::Role
config.servers
else
servers = config.servers[name]
servers.is_a?(Array) ? servers : servers["hosts"]
servers.is_a?(Array) ? servers : Array(servers["hosts"])
end
end