foreman-tasks 0.7.15 → 0.7.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31ae188eb51b073634a6022419eca1a9da0386ae
|
4
|
+
data.tar.gz: ac58624747c4767a2a6281a5b528bd7bec73cdfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee4441852726080335eed0f0b98b50a90aab99cebeacc774bff9e213068d4d6853338007d7b589a04703f96abd6792721a186536e48d58281f758ed1cb48655
|
7
|
+
data.tar.gz: 2989a4a292c841fcc829f9b3882edb3702915a0e40f32115c722fde27bf74c9f68507830df9938643c9f98a6673d58b6abd786a73f220c3d4114eda9225d7cb1
|
@@ -9,9 +9,14 @@ module Actions
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def plan(host_type, host_name, facts, certname, proxy_id)
|
12
|
-
|
12
|
+
facts['domain'].try(:downcase!)
|
13
|
+
host = ::Host::Base.import_host(host_name, certname, facts, proxy_id)
|
13
14
|
action_subject(host, :facts => facts)
|
14
|
-
|
15
|
+
if host.build?
|
16
|
+
::Foreman::Logging.logger('foreman-tasks').info "Skipping importing of facts for #{host.name} because it's in build mode"
|
17
|
+
else
|
18
|
+
plan_self
|
19
|
+
end
|
15
20
|
end
|
16
21
|
|
17
22
|
def run
|
@@ -8,6 +8,8 @@ module ForemanTasks
|
|
8
8
|
after_create :plan_create_action
|
9
9
|
after_update :plan_update_action
|
10
10
|
after_destroy :plan_destroy_action
|
11
|
+
|
12
|
+
alias_method_chain :save, :dynflow_task_wrap
|
11
13
|
end
|
12
14
|
|
13
15
|
# @override
|
@@ -22,8 +24,9 @@ module ForemanTasks
|
|
22
24
|
def destroy_action
|
23
25
|
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
+
|
28
|
+
def save_with_dynflow_task_wrap(*args)
|
29
|
+
dynflow_task_wrap(:save) { save_without_dynflow_task_wrap(*args) }
|
27
30
|
end
|
28
31
|
|
29
32
|
def save!(*args)
|
@@ -15,26 +15,29 @@ module ForemanTasks
|
|
15
15
|
module ClassMethods
|
16
16
|
# TODO: This should get into the Foreman core, extracting the
|
17
17
|
# +importHostAndFacts+ method into two
|
18
|
-
def
|
18
|
+
def import_host(hostname, certname, facts, proxy_id = nil)
|
19
|
+
raise(::Foreman::Exception.new("Invalid Facts, must be a Hash")) unless facts.is_a?(Hash)
|
19
20
|
raise(::Foreman::Exception.new("Invalid Hostname, must be a String")) unless hostname.is_a?(String)
|
20
21
|
|
21
22
|
# downcase everything
|
22
23
|
hostname.try(:downcase!)
|
23
24
|
certname.try(:downcase!)
|
24
25
|
|
25
|
-
host = certname.present? ? Host.
|
26
|
-
host ||= Host.
|
26
|
+
host = certname.present? ? Host.find_by_certname(certname) : nil
|
27
|
+
host ||= Host.find_by_name hostname
|
27
28
|
host ||= Host.new(:name => hostname, :certname => certname) if Setting[:create_new_host_when_facts_are_uploaded]
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
|
30
|
+
return Host.new if host.nil?
|
31
|
+
# if we were given a certname but found the Host by hostname we should update the certname
|
32
|
+
host.certname = certname if certname.present?
|
33
|
+
# if proxy authentication is enabled and we have no puppet proxy set and the upload came from puppet,
|
34
|
+
# use it as puppet proxy.
|
35
|
+
if facts['_type'].blank? || facts['_type'] == 'puppet'
|
32
36
|
host.puppet_proxy_id ||= proxy_id
|
33
|
-
host.save(:validate => false)
|
34
|
-
return host
|
35
|
-
else
|
36
|
-
return
|
37
37
|
end
|
38
|
+
|
39
|
+
host.save(:validate => false) if host.new_record?
|
40
|
+
host
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dynflow
|
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
244
|
version: '0'
|
245
245
|
requirements: []
|
246
246
|
rubyforge_project:
|
247
|
-
rubygems_version: 2.
|
247
|
+
rubygems_version: 2.4.8
|
248
248
|
signing_key:
|
249
249
|
specification_version: 4
|
250
250
|
summary: Foreman plugin for showing tasks information for resoruces and users
|
@@ -265,3 +265,4 @@ test_files:
|
|
265
265
|
- test/unit/recurring_logic_test.rb
|
266
266
|
- test/unit/task_groups_test.rb
|
267
267
|
- test/unit/task_test.rb
|
268
|
+
has_rdoc:
|