Class: Kamal::Lint::Checks::EmptyWebRole
- Inherits:
-
Kamal::Lint::Check
- Object
- Kamal::Lint::Check
- Kamal::Lint::Checks::EmptyWebRole
- Defined in:
- lib/kamal/lint/checks/empty_web_role.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 29 30 31 |
# File 'lib/kamal/lint/checks/empty_web_role.rb', line 14 def call servers = parsed["servers"] all_hosts = ServersHelper.all_hosts(servers) if servers.nil? || (servers.is_a?(Enumerable) && servers.empty?) return [ finding( message: "`servers:` is missing or empty; nothing will be deployed", line: context.line_for([ "servers" ]) || 1 ) ] end return [] unless all_hosts.empty? [ finding( message: "no hosts declared under any role in `servers:`; nothing will be deployed", line: context.line_for([ "servers" ]) || 1 ) ] end |