Class: Actions::Foreman::Host::ImportFacts
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from EntryAction
#action_subject, all_action_names, #delay, serializer_class
#exclusive_lock!, #link!, #lock!
#serialize_args
Methods inherited from Base
#already_running?, #humanized_errors, #humanized_output, #serializer_class, #task, #task_input, #task_output
Class Method Details
.cleanup_after ⇒ Object
default value for cleaning up the tasks, it can be overriden by settings
48
49
50
|
# File 'app/lib/actions/foreman/host/import_facts.rb', line 48
def self.cleanup_after
'30d'
end
|
Instance Method Details
43
44
45
|
# File 'app/lib/actions/foreman/host/import_facts.rb', line 43
def humanized_input
input[:host] && input[:host][:name]
end
|
#humanized_name ⇒ Object
39
40
41
|
# File 'app/lib/actions/foreman/host/import_facts.rb', line 39
def humanized_name
_("Import facts")
end
|
#plan(host_type, host_name, facts, certname, proxy_id) ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'app/lib/actions/foreman/host/import_facts.rb', line 11
def plan(host_type, host_name, facts, certname, proxy_id)
facts['domain'].try(:downcase!)
host = ::Host::Base.import_host(host_name, certname, facts, proxy_id)
action_subject(host, :facts => facts)
if host.build?
::Foreman::Logging.logger('foreman-tasks').info "Skipping importing of facts for #{host.name} because it's in build mode"
else
plan_self
end
end
|
#rescue_strategy ⇒ Object
35
36
37
|
# File 'app/lib/actions/foreman/host/import_facts.rb', line 35
def rescue_strategy
::Dynflow::Action::Rescue::Skip
end
|
#resource_locks ⇒ Object
7
8
9
|
# File 'app/lib/actions/foreman/host/import_facts.rb', line 7
def resource_locks
:import_facts
end
|
#run ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/lib/actions/foreman/host/import_facts.rb', line 22
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
raise e unless e.code == 'ERF51-9911'
end
|