foreman_chef 0.6.0 → 0.7.0

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: bed7f43a8fda06fdc85e6e6d2e6059dad4a0b3e2
4
- data.tar.gz: 01c9bc5cd705a62dc4ec7ce017b40446c5ee5974
3
+ metadata.gz: 075d1d5147bf46098837bb05f3900aa8ac850aed
4
+ data.tar.gz: 583d6747a7d02477f8fbde87cf21ff2f30ddc384
5
5
  SHA512:
6
- metadata.gz: 59b5c3e2e49bcf6b1e86902995fc14b5ca152f541c84f4f82e7d2529c6c65a9315fad4a59e1f94717f5eb4dfff68fae4aedde4fb0779a408ab0f0b9adf084f0e
7
- data.tar.gz: b3f03e1b028a868bb6ea788b9e59dcf89e592b70632736381da589057242617c3e2cae98c4fde8ba5fe22aaf289fbf96c9d9d186cc98e370bba655de93e657dd
6
+ metadata.gz: 3dc48433b44ff0a836cf36be0d2ab8cdbe1fc9b4e6ca367221d408a927587ed92b76fbf4e454a233e7b3f7968883e37909f61325bac449a70293355021ae976f
7
+ data.tar.gz: 4aa4081ab221c9d2d55afe7695f4c9516a7f683f28ad89bcc8124233f2280a847771ff7704faa31b279e4d10b410f68b159cd96cd76098aa31016fae05d0dcc3
@@ -1,21 +1,17 @@
1
1
  module ForemanChef
2
2
  module Concerns
3
3
  module HostsControllerRescuer
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- rescue_from ForemanChef::ProxyException, :with => :chef_exception
8
- # this route is only allowed to puppet proxies so we need to allow it for chef proxies too
9
- alias_method_chain :require_smart_proxy_or_login, :chef
4
+ def self.prepended(base)
5
+ base.rescue_from ForemanChef::ProxyException, :with => :chef_exception
10
6
  end
11
7
 
12
8
  private
13
9
 
14
- def require_smart_proxy_or_login_with_chef(features = nil)
10
+ def require_smart_proxy_or_login(features = nil)
15
11
  if params[:action] == 'externalNodes' && features.kind_of?(Array) && features.include?('Puppet')
16
- require_smart_proxy_or_login_without_chef(features + [ 'Chef' ])
12
+ super(features + [ 'Chef' ])
17
13
  else
18
- require_smart_proxy_or_login_without_chef(features)
14
+ super(features)
19
15
  end
20
16
  end
21
17
 
@@ -3,7 +3,7 @@ module ForemanChef
3
3
  include Foreman::Controller::AutoCompleteSearch
4
4
  include ForemanChef::Concerns::EnvironmentParameters
5
5
 
6
- before_filter :find_resource, :only => [:edit, :update, :destroy]
6
+ before_action :find_resource, :only => [:edit, :update, :destroy]
7
7
 
8
8
  def import
9
9
  proxy = SmartProxy.authorized(:view_smart_proxies).find(params[:proxy])
@@ -1,9 +1,10 @@
1
1
  module ForemanChef
2
2
  module Concerns
3
3
  module HostActionSubject
4
- extend ActiveSupport::Concern
5
- include ForemanTasks::Concerns::ActionSubject
6
- include ForemanTasks::Concerns::ActionTriggering
4
+ def self.prepended(base)
5
+ base.send :prepend, ForemanTasks::Concerns::ActionSubject
6
+ base.send :prepend, ForemanTasks::Concerns::ActionTriggering
7
+ end
7
8
 
8
9
  def update_action
9
10
  sync_action!
@@ -1,14 +1,11 @@
1
1
  module ForemanChef
2
2
  module Concerns
3
3
  module HostBuild
4
- extend ActiveSupport::Concern
5
- included do
6
- include ForemanTasks::Concerns::ActionSubject
7
- include ForemanTasks::Concerns::ActionTriggering
4
+ def self.prepended(base)
5
+ base.send :prepend, ForemanTasks::Concerns::ActionSubject
6
+ base.send :prepend, ForemanTasks::Concerns::ActionTriggering
8
7
 
9
- alias_method_chain :setSSHProvisionScript, :chef
10
-
11
- after_build do |host|
8
+ base.after_build do |host|
12
9
  ::ForemanTasks.sync_task ::Actions::ForemanChef::Client::Destroy, host.name, host.chef_proxy
13
10
  # private key is no longer valid
14
11
  host.chef_private_key = nil
@@ -22,7 +19,7 @@ module ForemanChef
22
19
  end
23
20
  end
24
21
 
25
- def setSSHProvisionScript_with_chef
22
+ def setSSHProvisionScript
26
23
  ::ForemanTasks.sync_task ::Actions::ForemanChef::Client::Destroy, self.name, self.chef_proxy
27
24
  # private key is no longer valid
28
25
  self.chef_private_key = nil
@@ -32,7 +29,7 @@ module ForemanChef
32
29
  self.chef_private_key = new_client.output[:private_key]
33
30
  end
34
31
 
35
- self.disable_dynflow_hooks { |h| setSSHProvisionScript_without_chef; h.save! }
32
+ self.disable_dynflow_hooks { |h| super; h.save! }
36
33
  end
37
34
  end
38
35
  end
@@ -1,16 +1,12 @@
1
1
  module ForemanChef
2
2
  module Concerns
3
3
  module HostExtensions
4
- extend ActiveSupport::Concern
5
-
6
4
  DEFAULT = ['role[default]']
7
5
 
8
- included do
9
- alias_method_chain :inherited_attributes, :chef_attributes
10
-
6
+ def self.prepended(base)
11
7
  # even with autosave, save is called only if there's some change in attributes
12
- has_one :cached_run_list, :autosave => true, :class_name => 'ForemanChef::CachedRunList', :foreign_key => :host_id
13
- attr_accessor :override_chef_attributes
8
+ base.has_one :cached_run_list, :autosave => true, :class_name => 'ForemanChef::CachedRunList', :foreign_key => :host_id
9
+ base.send :attr_accessor, :override_chef_attributes
14
10
  end
15
11
 
16
12
  def run_list
@@ -63,8 +59,8 @@ module ForemanChef
63
59
  run_list_differs? || chef_environment_differs?
64
60
  end
65
61
 
66
- def inherited_attributes_with_chef_attributes
67
- inherited_attributes_without_chef_attributes.concat(%w(chef_proxy_id chef_environment_id))
62
+ def inherited_attributes
63
+ super.concat(%w(chef_proxy_id chef_environment_id))
68
64
  end
69
65
 
70
66
  private
@@ -3,14 +3,12 @@ module ForemanChef
3
3
  module SmartProxyExtensions
4
4
  extend ActiveSupport::Concern
5
5
 
6
- included do
7
- alias_method_chain :taxonomy_foreign_conditions, :chef
8
-
9
- has_many :chef_environments, :class_name => "::ForemanChef::Environment", :foreign_key => 'chef_proxy_id'
6
+ def self.prepended(base)
7
+ base.has_many :chef_environments, :class_name => "::ForemanChef::Environment", :foreign_key => 'chef_proxy_id'
10
8
  end
11
9
 
12
- def taxonomy_foreign_conditions_with_chef
13
- conditions = taxonomy_foreign_conditions_without_chef
10
+ def taxonomy_foreign_conditions
11
+ conditions = super
14
12
  if has_feature?('Chef')
15
13
  conditions[:chef_proxy_id] = id
16
14
  end
@@ -1,4 +1,4 @@
1
- class AddChefProxyIdToHost < ActiveRecord::Migration
1
+ class AddChefProxyIdToHost < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :hosts, :chef_proxy_id, :integer
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddChefProxyIdToHostgroup < ActiveRecord::Migration
1
+ class AddChefProxyIdToHostgroup < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :hostgroups, :chef_proxy_id, :integer
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateChefEnvironment < ActiveRecord::Migration
1
+ class CreateChefEnvironment < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  create_table :foreman_chef_environments do |t|
4
4
  t.string :name, :default => '', :null => false
@@ -1,4 +1,4 @@
1
- class CreateForemanChefCachedRunList < ActiveRecord::Migration
1
+ class CreateForemanChefCachedRunList < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :foreman_chef_cached_run_lists do |t|
4
4
  t.text :list, :null => false
@@ -1,4 +1,4 @@
1
- class AddChefPrivateKeyToHost < ActiveRecord::Migration
1
+ class AddChefPrivateKeyToHost < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :hosts, :chef_private_key, :text
4
4
  end
@@ -47,7 +47,7 @@ module ForemanChef
47
47
 
48
48
  initializer 'foreman_chef.register_plugin', :before => :finisher_hook do |app|
49
49
  Foreman::Plugin.register :foreman_chef do
50
- requires_foreman '>= 1.15'
50
+ requires_foreman '>= 1.17'
51
51
  extend_template_helpers ForemanChef::Concerns::Renderer
52
52
 
53
53
  permission :import_chef_environments, { :environments => [:import, :synchronize] }, :resource_type => 'ForemanChef::Environment'
@@ -88,12 +88,12 @@ module ForemanChef
88
88
 
89
89
  ::Host::Managed.send :include, ForemanChef::Concerns::HostAndHostgroupExtensions
90
90
  ::Hostgroup.send :include, ForemanChef::Concerns::HostAndHostgroupExtensions
91
- ::Host::Managed.send :include, ForemanChef::Concerns::HostExtensions
91
+ ::Host::Managed.send :prepend, ForemanChef::Concerns::HostExtensions
92
92
  ::Hostgroup.send :include, ForemanChef::Concerns::HostgroupExtensions
93
- ::SmartProxy.send :include, ForemanChef::Concerns::SmartProxyExtensions
94
- ::Host::Managed.send :include, ForemanChef::Concerns::HostActionSubject
95
- ::Host::Managed.send :include, ForemanChef::Concerns::HostBuild
96
- ::HostsController.send :include, ForemanChef::Concerns::HostsControllerRescuer
93
+ ::SmartProxy.send :prepend, ForemanChef::Concerns::SmartProxyExtensions
94
+ ::Host::Managed.send :prepend, ForemanChef::Concerns::HostActionSubject
95
+ ::Host::Managed.send :prepend, ForemanChef::Concerns::HostBuild
96
+ ::HostsController.send :prepend, ForemanChef::Concerns::HostsControllerRescuer
97
97
 
98
98
  ::Host::Managed.send :include, ForemanChef::Concerns::Renderer
99
99
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanChef
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Hulan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-22 00:00:00.000000000 Z
11
+ date: 2018-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  requirements: []
142
142
  rubyforge_project:
143
- rubygems_version: 2.6.8
143
+ rubygems_version: 2.4.5
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Plugin for Chef integration with Foreman