Validate that all roles have hosts
This commit is contained in:
@@ -80,7 +80,7 @@ class Mrsk::Configuration
|
||||
end
|
||||
|
||||
def primary_web_host
|
||||
role(:web).hosts.first
|
||||
role(:web).primary_host
|
||||
end
|
||||
|
||||
def traefik_hosts
|
||||
@@ -196,6 +196,12 @@ class Mrsk::Configuration
|
||||
raise ArgumentError, "You must specify a password for the registry in config/deploy.yml (or set the ENV variable if that's used)"
|
||||
end
|
||||
|
||||
roles.each do |role|
|
||||
if role.hosts.empty?
|
||||
raise ArgumentError, "No servers specified for the #{role.name} role"
|
||||
end
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user