Ensure that the restart policy is unless-stopped
No other restart policy makes sense to don't let it be changed. Fixes: https://github.com/basecamp/kamal/issues/749
This commit is contained in:
@@ -168,4 +168,10 @@ class Kamal::Configuration::Validator
|
||||
unknown_keys.reject! { |key| extension?(key) } if allow_extensions?
|
||||
unknown_keys_error unknown_keys if unknown_keys.present?
|
||||
end
|
||||
|
||||
def validate_docker_options!(options)
|
||||
if options
|
||||
error "Cannot set restart policy in docker options, unless-stopped is required" if options["restart"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,5 +5,7 @@ class Kamal::Configuration::Validator::Accessory < Kamal::Configuration::Validat
|
||||
if (config.keys & [ "host", "hosts", "roles" ]).size != 1
|
||||
error "specify one of `host`, `hosts` or `roles`"
|
||||
end
|
||||
|
||||
validate_docker_options!(config["options"])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,6 +6,7 @@ class Kamal::Configuration::Validator::Role < Kamal::Configuration::Validator
|
||||
validate_servers!(config)
|
||||
else
|
||||
super
|
||||
validate_docker_options!(config["options"])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user