Class: DnsMadeEasy::CLI::Commands::Zone::Validate
- Defined in:
- lib/dnsmadeeasy/cli/commands/zone.rb
Overview
Validates a standard DNS zone file.
Constant Summary
Constants inherited from Base
Base::DEFAULT_CREDENTIAL_PATHS, Base::SUPPORTED_FORMATS
Instance Method Summary collapse
Instance Method Details
#call(file:) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dnsmadeeasy/cli/commands/zone.rb', line 27 def call(file:, **) result = DnsMadeEasy::Zone::Parser.new(::File.read(file)).call if result.success? record_count = result.value!.records.length MessageHelpers.success("Zone file is valid.\nRecords: #{record_count}") else MessageHelpers.warn("Zone file is invalid.\n#{result.failure.join("\n")}") raise ArgumentError, 'zone file is invalid' end end |