Project

General

Profile

« Previous | Next » 

Revision e54016da

Added by Marek Hulán over 8 years ago

Fixes #10782 - global host status

Introduce new global host status that is composed of host substatuses.
Each substatus defines a mapping to the global one which can result in
three values
  • OK
  • WARN
  • ERROR

Plugins can add their own substatuses. These are automatically
propagated also to API.

Thanks to Tomas Strachota who wrote the original code.

View differences:

test/unit/host_build_status_test.rb
:domain => domains(:mydomain), :operatingsystem => operatingsystems(:redhat), :subnet => subnets(:one), :puppet_proxy => smart_proxies(:puppetmaster),
:architecture => architectures(:x86_64), :environment => environments(:production), :managed => true,
:owner_type => "User", :root_pass => "xybxa6JUkz63w")
@build = @host.build_status
@build = @host.build_status_checker
# bypass host.valid?
HostBuildStatus.any_instance.stubs(:host_status).returns(true)
end
......
host = @host
kind = FactoryGirl.create(:template_kind)
FactoryGirl.create(:provisioning_template, :template => "provision script <%= @foreman.server.status %>",:name => "My Failed Template", :template_kind => kind, :operatingsystem_ids => [host.operatingsystem_id], :environment_ids => [host.environment_id], :hostgroup_ids => [host.hostgroup_id] )
@build = host.build_status
@build = host.build_status_checker
refute_empty @build.errors[:templates]
end

Also available in: Unified diff