Sha256: d6593dc91d0e17593ea01f249bdf67399830d9808e36222f8bca4cc975f32b20
Contents?: true
Size: 1.18 KB
Versions: 5
Compression:
Stored size: 1.18 KB
Contents
module Actions module Foreman module Host class ImportFacts < Actions::EntryAction def resource_locks :import_facts end def plan(host_type, host_name, facts, certname, proxy_id) host = ::Host::Base.importHost(host_name, certname, proxy_id) action_subject(host, :facts => facts) plan_self end def run ::User.as :admin do host = ::Host.find(input[:host][:id]) state = host.import_facts(input[:facts]) output[:state] = state end rescue ::Foreman::Exception => e # This error is what is thrown by Host#ImportHostAndFacts when # the Host is in the build state. This can be refactored once # issue #3959 is fixed. raise e unless e.code == 'ERF51-9911' end def humanized_name _("Import facts") end def humanized_input input[:host] && input[:host][:name] end # default value for cleaning up the tasks, it can be overriden by settings def self.cleanup_after '30d' end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems