Method: Beaker::Options::Parser#parse_hosts_options
- Defined in:
- lib/beaker/options/parser.rb
#parse_hosts_options ⇒ Hash
Parse hosts options from host files into a host options hash. Falls back to trying as a beaker-hostgenerator string if reading the hosts file doesn’t work
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/beaker/options/parser.rb', line 283 def if [:hosts_file].nil? || File.exists?([:hosts_file]) #read the hosts file that contains the node configuration and hypervisor info return Beaker::Options::HostsFileParser.parse_hosts_file([:hosts_file]) end = "\nHosts file '#{@options[:hosts_file]}' does not exist." << "\nTrying as beaker-hostgenerator input.\n\n" $stdout.puts require 'beaker-hostgenerator' = [ [:hosts_file] ] += [ '--hypervisor', ENV['BEAKER_HYPERVISOR'] ] if ENV['BEAKER_HYPERVISOR'] hosts_file_content = begin bhg_cli = BeakerHostGenerator::CLI.new() bhg_cli.execute rescue BeakerHostGenerator::Exceptions::Error, BeakerHostGenerator::Exceptions::InvalidNodeSpecError => error = "\nbeaker-hostgenerator was not able to use this value as input." << "\nExiting with an Error.\n\n" $stderr.puts raise error end [:hosts_file_generated] = true Beaker::Options::HostsFileParser.parse_hosts_string( hosts_file_content ) end |