Class: Longleaf::ValidateConfigCommand
- Inherits:
-
Object
- Object
- Longleaf::ValidateConfigCommand
- Includes:
- EventStatusTracking
- Defined in:
- lib/longleaf/commands/validate_config_command.rb
Overview
Command for validating an application configuration file
Instance Method Summary collapse
-
#execute ⇒ Object
Execute the validate command on the specified configuration yml file.
-
#initialize(config_path) ⇒ ValidateConfigCommand
constructor
A new instance of ValidateConfigCommand.
Methods included from EventStatusTracking
#record_failure, #record_success, #return_status, #track_failure, #track_status, #track_success
Methods included from Logging
#initialize_logger, initialize_logger, logger, #logger
Constructor Details
#initialize(config_path) ⇒ ValidateConfigCommand
Returns a new instance of ValidateConfigCommand.
9 10 11 |
# File 'lib/longleaf/commands/validate_config_command.rb', line 9 def initialize(config_path) @config_path = config_path end |
Instance Method Details
#execute ⇒ Object
Execute the validate command on the specified configuration yml file
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/longleaf/commands/validate_config_command.rb', line 14 def execute start_time = Time.now logger.info('Performing validate configuration command') begin app_config_manager = Longleaf::ApplicationConfigDeserializer.deserialize(@config_path) location_manager = app_config_manager.location_manager location_manager.locations.each do |name, location| location.available? end validate_services(app_config_manager.service_manager) record_success("Application configuration passed validation: #{@config_path}") rescue Longleaf::ConfigurationError, Longleaf::StorageLocationUnavailableError => err record_failure("Application configuration invalid due to the following issue(s):\n#{err.}") rescue => err record_failure("Failed to validate application configuration", error: err) end logger.info("Completed validate configuration command in #{Time.now - start_time}s") return_status end |