Method: Beaker::Options::Parser#normalize_args
- Defined in:
- lib/beaker/options/parser.rb
#normalize_args ⇒ Object
Validate all merged options values for correctness
Currently checks:
- each host has a valid platform
- if a keyfile is provided then use it
- paths provided to --test, --pre-suite, --post-suite provided lists of .rb files for testing
- --fail-mode is one of 'fast', 'stop' or nil
- if using blimpy hypervisor an EC2 YAML file exists
- if using the aix, solaris, or vcloud hypervisors a .fog file exists
- that one and only one master is defined per set of hosts
- that solaris/windows/aix hosts are agent only for PE tests OR
- sets the default host based upon machine definitions
- if an ssh user has been defined make it the host user
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/beaker/options/parser.rb', line 327 def normalize_args ['HOSTS'].each_key do |name| @validator.validate_platform(['HOSTS'][name], name) ['HOSTS'][name]['platform'] = Platform.new(['HOSTS'][name]['platform']) end #use the keyfile if present if .has_key?(:keyfile) [:ssh][:keys] = [[:keyfile]] end #split out arguments - these arguments can have the form of arg1,arg2 or [arg] or just arg #will end up being normalized into an array LONG_OPTS.each do |opt| if .has_key?(opt) update_option(opt, split_arg([opt]), 'runtime') if RB_FILE_OPTS.include?(opt) && (not [opt] == []) update_option(opt, file_list([opt]), 'runtime') end if opt == :install update_option(:install, parse_git_repos([:install]), 'runtime') end else update_option(opt, [], 'runtime') end end @validator.validate_fail_mode([:fail_mode]) @validator.validate_preserve_hosts([:preserve_hosts]) #check for config files necessary for different hypervisors hypervisors = get_hypervisors([:HOSTS]) hypervisors.each do |visor| check_hypervisor_config(visor) end #check that roles of hosts make sense # - must be one and only one master master = 0 roles = get_roles([:HOSTS]) roles.each do |role_array| master += 1 if role_array.include?('master') @validator.validate_frictionless_roles(role_array) end @validator.validate_master_count(master) #check that windows/el-4 boxes are only agents (solaris can be a master in foss cases) [:HOSTS].each_key do |name| host = [:HOSTS][name] if host[:platform] =~ /windows|el-4/ test_host_roles(name, host) end #check to see if a custom user account has been provided, if so use it if host[:ssh] && host[:ssh][:user] host[:user] = host[:ssh][:user] end # merge host tags for this host with the global/preset host tags host[:host_tags] = [:host_tags].merge(host[:host_tags] || {}) end @validator.( [:test_tag_and], [:test_tag_or], [:test_tag_exclude] ) resolve_symlinks! #set the default role set_default_host!([:HOSTS]) end |