theforeman/foreman · error · Foreman::Renderer::Errors::UnknownHostStatusError

Unknown host status "%{status}" was specified in host_status

Error message

Unknown host status "%{status}" was specified in host_status macro, use one of %{statuses}

What it means

Error "Unknown host status "%{status}" was specified in host_status macro, use one of %{statuses}" thrown in theforeman/foreman.

Source

Thrown at app/services/foreman/renderer/scope/macros/base.rb:240

            returns object_of: Hash, desc: 'Hash representing all statuses for a given host in human-readable format'
            example 'all_host_statuses_labels(@host) # => {"Build"=>"Installed", "Compliance"=>"Not applicable", "Configuration"=>"No reports", "Errata"=>"Security errata applicable", "Execution"=>"Last execution succeeded", "Role"=>"Unknown", "Service Level"=>"Unknown", "Subscription"=>"Simple Content Access", "System Purpose"=>"Unknown", "Traces"=>"No processes require restarting", "Usage"=>"Unknown"}'
            example "<%- load_hosts.each_record do |host| -%>\n<%= host.name -%>, <%=   all_host_statuses_labels(host)['Subscription'] %>\n<%- end -%>"
          end
          def all_host_statuses_labels_hash(host)
            all_host_statuses.map { |status| [status.status_name, host_status(host, status.status_name).to_label] }.to_h
          end

          apipie :method, 'Returns a specific status for a given host' do
            desc "The return value is a human readable representation of the status.
              For details about the number meaning, see documentation for every status class."
            required :host, 'Host::Managed', desc: 'a host object for which the status will be checked'
            required :name, HostStatus.status_registry.to_a.map(&:status_name).sort, desc: 'name of the host substatus to be checked'
            returns String, desc: 'A human readable, textual representation of the status for a given host'
            example 'host_status(@host, "Subscription") # => "Fully entitled"'
          end
          def host_status(host, name)
            klass = all_host_statuses.find { |status| status.status_name == name }
            raise UnknownHostStatusError.new(status: name, statuses: all_host_statuses.map(&:status_name).join(',')) if klass.nil?
            host.get_status(klass)
          end

          apipie :method, desc: "Returns a name of a given users auth source" do
            required :user, 'User', desc: 'a user for which the auth source name will be returned'
            returns String, desc: 'An auth source name of specified user, nil if auth source could not be found'
            example '<% load_users(search: "admin = true").each_record { |u| report_row login: u.login, auth_source: user_auth_source_name(u)  } -%>\n<%= report_render %>'
          end
          def user_auth_source_name(user)
            user.auth_source&.name
          end

          apipie :method, 'Returns true if template rendering is running in preview mode' do
            desc "This is useful if the template would execute commands, that shouldn't be
              executed while previewing the template output. Examples may be performance
              heavy operations, destructive operations etc."
            returns one_of: [true, false], desc: 'A boolean value, true for preview mode, false otherwise'
            example '<%= preview? ? "# skipping in preview mode" : @host.facts_hash["ssh::rsa::fingerprints::sha256"] -%>'

View on GitHub (pinned to 6b05625475)

When it happens

Trigger: Thrown at app/services/foreman/renderer/scope/macros/base.rb:240 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of theforeman/foreman@6b05625475 (2026-08-23). Data as JSON: /api/errors/7e5255e58693aff6. Report an issue: GitHub.