Class: Kamal::Lint::Checks::BootLimitExceedsHosts
- Inherits:
-
Kamal::Lint::Check
- Object
- Kamal::Lint::Check
- Kamal::Lint::Checks::BootLimitExceedsHosts
- Defined in:
- lib/kamal/lint/checks/boot_limit_exceeds_hosts.rb
Instance Attribute Summary
Attributes inherited from Kamal::Lint::Check
Instance Method Summary collapse
Methods inherited from Kamal::Lint::Check
applies_to?, autofixable, id, #initialize, severity, since, title, until_version
Constructor Details
This class inherits a constructor from Kamal::Lint::Check
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/kamal/lint/checks/boot_limit_exceeds_hosts.rb', line 14 def call boot = parsed["boot"] return [] unless boot.is_a?(Hash) limit = boot["limit"] return [] unless limit.is_a?(Integer) && limit > 0 host_count = ServersHelper.all_hosts(parsed["servers"]).uniq.size return [] if host_count == 0 || limit <= host_count [ finding( message: "boot.limit is #{limit} but only #{host_count} host(s) are configured; the limit has no effect", line: context.line_for([ "boot", "limit" ]) ) ] end |