foreman-tasks 0.10.3 → 0.10.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae915bf659a976d2dfcac1f2e51cb0a447d080a8
4
- data.tar.gz: 41bf2fb543e2ba405f828be97d0727ff9ec73c17
3
+ metadata.gz: f9103450a91bdc6f9bee1c15d50063375050da83
4
+ data.tar.gz: be2ba86f7efd177e77839d2dc03f2e14ea2daebe
5
5
  SHA512:
6
- metadata.gz: 3b641565b6e1360887774df9489089c2e5e960d299b976140f307b15e2b8e7d92815900541124265eead2a6294a57fae798371bab3074f4026f71cc6298ce6f4
7
- data.tar.gz: b9304f40c6ab2f54a37bc92f93d68e6fb81f3cae68e63d5299994f9e5a5c1bc466d3d081e6047067cac2901e3664e58734421549c3892f2fce400347f871d7ac
6
+ metadata.gz: 6dbf21fc4596c5953fdef37ca2e45beb32d267a39fd895e5f055d641feae0b113d474d632cb2d6a41c16d789dc584634511be8b5a39dbfdcf5e9e57a26288ffd
7
+ data.tar.gz: 1ee999e8e037c53781e9afe746864fe78c894774f4bc32df820db53397bdbb5739aa1d99c1baf3f7094b7f4234b5c85a91076c58977938fcea20315caf75373a
@@ -8,7 +8,13 @@ module Actions
8
8
 
9
9
  def plan(_host_type, host_name, facts, certname, proxy_id)
10
10
  facts['domain'].try(:downcase!)
11
- host = ::Host::Base.import_host(host_name, certname, facts, proxy_id)
11
+ host = if SETTINGS[:version] > '1.16'
12
+ ::Host::Base.import_host(host_name, certname, proxy_id)
13
+ else
14
+ # backwards compatibility
15
+ ::Host::Managed.import_host(host_name, facts['_type'], certname, proxy_id)
16
+ end
17
+ host.save(:validate => false) if host.new_record?
12
18
  action_subject(host, :facts => facts)
13
19
  if host.build?
14
20
  ::Foreman::Logging.logger('foreman-tasks').info "Skipping importing of facts for #{host.name} because it's in build mode"
@@ -11,35 +11,6 @@ module ForemanTasks
11
11
  def available_locks
12
12
  [:read, :write, :import_facts]
13
13
  end
14
-
15
- module ClassMethods
16
- # TODO: This should get into the Foreman core, extracting the
17
- # +importHostAndFacts+ method into two
18
- def import_host(hostname, certname, facts, proxy_id = nil)
19
- raise Foreman::Exception, 'Invalid Facts, must be a Hash' unless facts.is_a?(Hash)
20
- raise Foreman::Exception, 'Invalid Hostname, must be a String' unless hostname.is_a?(String)
21
-
22
- # downcase everything
23
- hostname.try(:downcase!)
24
- certname.try(:downcase!)
25
-
26
- host = certname.present? ? Host.find_by(certname: certname) : nil
27
- host ||= Host.find_by name: hostname
28
- host ||= Host.new(:name => hostname, :certname => certname) if Setting[:create_new_host_when_facts_are_uploaded]
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'
36
- host.puppet_proxy_id ||= proxy_id
37
- end
38
-
39
- host.save(:validate => false) if host.new_record?
40
- host
41
- end
42
- end
43
14
  end
44
15
  end
45
16
  end
@@ -1,6 +1,4 @@
1
- # Require foreman's lib directory which contains foreman/dynflow/configuration
2
- lib_foreman = File.expand_path('lib/foreman', Rails.root)
3
- require lib_foreman if Dir.exist?(lib_foreman)
1
+ require File.expand_path('lib/foreman/dynflow/configuration', Rails.root)
4
2
  require 'foreman_tasks/dynflow/persistence'
5
3
 
6
4
  module ForemanTasks
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = '0.10.3'.freeze
2
+ VERSION = '0.10.4'.freeze
3
3
  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.10.3
4
+ version: 0.10.4
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: 2017-09-21 00:00:00.000000000 Z
11
+ date: 2017-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman-tasks-core