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
Constants included from MessageHelpers
Instance Method Summary collapse
Methods included from MessageHelpers
error, included, info, print_box, success, warn
Instance Method Details
#call(file:) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dnsmadeeasy/cli/commands/zone.rb', line 28 def call(file:, **) result = DnsMadeEasy::Zone::Parser.new(::File.read(file)).call if result.success? record_count = result.value!.records.length success("Zone file is valid.\nRecords: #{record_count}") else warning("Zone file is invalid.\n#{result.failure.join("\n")}") raise ReportedError, 'zone file is invalid' end end |