30 lines
699 B
Ruby
30 lines
699 B
Ruby
#!/usr/bin/env ruby
|
|
|
|
require './rubyqa'
|
|
|
|
include RubyQA
|
|
$Manager = Manager.new
|
|
|
|
host = Host.new(
|
|
:ip => '127.0.0.1',
|
|
:user => 'tristan',
|
|
:cluster => true
|
|
)
|
|
|
|
Manager.new_test("hostname in /etc/hostname") {|host|
|
|
hostname = host.exec('cat /etc/hostname').strip
|
|
facts = host.resources['facts'].data
|
|
facts['networking']['hostname'] == hostname
|
|
}
|
|
|
|
Manager.new_test("hostname in /etc/hosts", :cluster => true ) {|host|
|
|
facts = host.resources['facts'].data
|
|
hostname = facts['networking']['hostname']
|
|
hosts = host.exec('cat /etc/hosts')
|
|
match_regex = /127\.0\.0\.1.+#{hostname.downcase}/
|
|
hosts.match? match_regex
|
|
}
|
|
$Manager.add_host(host)
|
|
$Manager.run_tests
|
|
$Manager.report
|