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:

app/views/api/v2/hosts/main.json.rabl
extends "api/v2/hosts/base"
# we need to cache results with @last_reports, rabl can't pass custom parameters to attriute methods
@object.global_status_label(:last_reports => @last_reports)
@object.configuration_status(:last_reports => @last_reports)
@object.configuration_status_label(:last_reports => @last_reports)
attributes :ip, :environment_id, :environment_name, :last_report, :mac, :realm_id, :realm_name,
:sp_mac, :sp_ip, :sp_name, :domain_id, :domain_name, :architecture_id, :architecture_name, :operatingsystem_id, :operatingsystem_name,
:subnet_id, :subnet_name, :sp_subnet_id, :ptable_id, :ptable_name, :medium_id, :medium_name, :build,
......
:enabled, :puppet_ca_proxy_id, :managed, :use_image, :image_file, :uuid, :compute_resource_id, :compute_resource_name,
:compute_profile_id, :compute_profile_name, :capabilities, :provision_method,
:puppet_proxy_id, :certname, :image_id, :image_name, :created_at, :updated_at,
:last_compile, :puppet_status
:last_compile, :global_status, :global_status_label
attributes :organization_id, :organization_name if SETTINGS[:organizations_enabled]
attributes :location_id, :location_name if SETTINGS[:locations_enabled]
# to avoid deprecation warning on puppet_status method
attributes :configuration_status => :puppet_status
HostStatus.status_registry.each do |status_class|
attributes "#{status_class.humanized_name}_status", "#{status_class.humanized_name}_status_label", :if => @object.get_status(status_class).relevant?
end

Also available in: Unified diff