Check for label presence in the validation, don't validate labels on simple role setup
This commit is contained in:
@@ -170,6 +170,8 @@ class Kamal::Configuration::Validator
|
|||||||
end
|
end
|
||||||
|
|
||||||
def validate_labels!(labels)
|
def validate_labels!(labels)
|
||||||
|
return true if labels.blank?
|
||||||
|
|
||||||
with_context("labels") do
|
with_context("labels") do
|
||||||
labels.each do |key, _|
|
labels.each do |key, _|
|
||||||
with_context(key) do
|
with_context(key) do
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Kamal::Configuration::Validator::Accessory < Kamal::Configuration::Validat
|
|||||||
error "specify one of `host`, `hosts`, `role`, `roles`, `tag` or `tags`"
|
error "specify one of `host`, `hosts`, `role`, `roles`, `tag` or `tags`"
|
||||||
end
|
end
|
||||||
|
|
||||||
validate_labels!(config["labels"]) if config.key?("labels")
|
validate_labels!(config["labels"])
|
||||||
|
|
||||||
validate_docker_options!(config["options"])
|
validate_docker_options!(config["options"])
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ class Kamal::Configuration::Validator::Role < Kamal::Configuration::Validator
|
|||||||
def validate!
|
def validate!
|
||||||
validate_type! config, Array, Hash
|
validate_type! config, Array, Hash
|
||||||
|
|
||||||
validate_labels!(config["labels"]) if config.key?("labels")
|
|
||||||
|
|
||||||
if config.is_a?(Array)
|
if config.is_a?(Array)
|
||||||
validate_servers!(config)
|
validate_servers!(config)
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
|
validate_labels!(config["labels"])
|
||||||
validate_docker_options!(config["options"])
|
validate_docker_options!(config["options"])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user