Fix bug in role validate_servers.
There were typo-bug during `validate_servers!` invocation for role. It wasn't discovered, because it never met condition. Because role_config wasn't correctly extracted for validation. Also remove not used anymore `accessories_on`. Leftover from previous changes.
This commit is contained in:
@@ -76,11 +76,6 @@ class Kamal::Commander
|
|||||||
config.accessories&.collect(&:name) || []
|
config.accessories&.collect(&:name) || []
|
||||||
end
|
end
|
||||||
|
|
||||||
def accessories_on(host)
|
|
||||||
config.accessories.select { |accessory| accessory.hosts.include?(host.to_s) }.map(&:name)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def app(role: nil, host: nil)
|
def app(role: nil, host: nil)
|
||||||
Kamal::Commands::App.new(config, role: role, host: host)
|
Kamal::Commands::App.new(config, role: role, host: host)
|
||||||
end
|
end
|
||||||
@@ -129,7 +124,6 @@ class Kamal::Commander
|
|||||||
config.aliases[name]
|
config.aliases[name]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def with_verbosity(level)
|
def with_verbosity(level)
|
||||||
old_level = self.verbosity
|
old_level = self.verbosity
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Kamal::Configuration::Role
|
|||||||
def initialize(name, config:)
|
def initialize(name, config:)
|
||||||
@name, @config = name.inquiry, config
|
@name, @config = name.inquiry, config
|
||||||
validate! \
|
validate! \
|
||||||
specializations,
|
role_config,
|
||||||
example: validation_yml["servers"]["workers"],
|
example: validation_yml["servers"]["workers"],
|
||||||
context: "servers/#{name}",
|
context: "servers/#{name}",
|
||||||
with: Kamal::Configuration::Validator::Role
|
with: Kamal::Configuration::Validator::Role
|
||||||
@@ -204,11 +204,11 @@ class Kamal::Configuration::Role
|
|||||||
end
|
end
|
||||||
|
|
||||||
def specializations
|
def specializations
|
||||||
if config.raw_config.servers.is_a?(Array) || config.raw_config.servers[name].is_a?(Array)
|
@specializations ||= role_config.is_a?(Array) ? {} : role_config
|
||||||
{}
|
end
|
||||||
else
|
|
||||||
config.raw_config.servers[name]
|
def role_config
|
||||||
end
|
@role_config ||= config.raw_config.servers.is_a?(Array) ? {} : config.raw_config.servers[name]
|
||||||
end
|
end
|
||||||
|
|
||||||
def custom_labels
|
def custom_labels
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class Kamal::Configuration::Validator::Role < Kamal::Configuration::Validator
|
|||||||
validate_type! config, Array, Hash
|
validate_type! config, Array, Hash
|
||||||
|
|
||||||
if config.is_a?(Array)
|
if config.is_a?(Array)
|
||||||
validate_servers! "servers", config
|
validate_servers!(config)
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user