foreman_setup 4.0.0 → 5.0.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: be2c21aab067c9a71805c4a61c9d79c803c01e55
4
- data.tar.gz: a61f30441ef62da762a8686b848bb861f8c1a743
3
+ metadata.gz: d5a8af59d427af8214977639e543c4cd4f4fa5f1
4
+ data.tar.gz: 68f2949405814f9f0cb1009c9cfc0303c3a4965a
5
5
  SHA512:
6
- metadata.gz: 1fdc207acb0b3f85419b13cc436193376965226e30f0b008796898b8cf5000e029de48cc0a9d60036bb53d0478e4ebb47a815683053acc7b08ec07c837eac0d1
7
- data.tar.gz: 29de4ecac44e3e9cc0ebe12f5e3879595b422518ddc5cd1368ab751553f6cb28325c1096d107d69f4af16fdad81b85ade4c09c05a2bb6e8b016b159cfb612882
6
+ metadata.gz: 3ae2f7c5df551c5640faa48e72ed4fc44006d9bb7fa773060c2461f3ae71cf66907b3eddd01b585c13bd94bdd22cf67a9ee8cdf00adf9c2c2d8695ebaec7ad90
7
+ data.tar.gz: 93eb0b0da19d50b86dfef0630d32ba86b86f051acc048e2e466cbc7c22dbebf4810c436f54b4d73875f6645dac00e8186e87964179e04de1651da5c947d24479
data/CHANGES.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## v5.0.0
4
+ * fix Foreman 1.13 compatibility with parameter filtering
5
+
3
6
  ## v4.0.0
4
7
  * fix Foreman 1.12 compatibility with icons, CSS, template rendering etc.
5
8
  * fix empty DHCP range in installer arguments if left blank
data/README.md CHANGED
@@ -24,6 +24,7 @@ RPM users can install the "tfm-rubygem-foreman_setup" or
24
24
  | >= 1.5 | ~> 2.0 |
25
25
  | >= 1.9 | ~> 3.0 |
26
26
  | >= 1.12 | ~> 4.0 |
27
+ | >= 1.13 | ~> 5.0 |
27
28
 
28
29
  # Areas this should help
29
30
 
@@ -3,6 +3,8 @@ require 'facter'
3
3
  module ForemanSetup
4
4
  class ProvisionersController < ::ApplicationController
5
5
  include Foreman::Controller::ProvisioningTemplates
6
+ include Foreman::Controller::Parameters::Medium
7
+ include Foreman::Controller::Parameters::Subnet
6
8
  include Foreman::Renderer
7
9
 
8
10
  before_filter :find_myself, :only => [:new, :create]
@@ -27,7 +29,7 @@ module ForemanSetup
27
29
  end
28
30
 
29
31
  def create
30
- @provisioner = Provisioner.new(params['foreman_setup_provisioner'])
32
+ @provisioner = Provisioner.new(provisioner_params)
31
33
  if @provisioner.save
32
34
  redirect_to step2_foreman_setup_provisioner_path(@provisioner)
33
35
  else
@@ -52,11 +54,11 @@ module ForemanSetup
52
54
  def step2_update
53
55
  @provisioner.hostgroup ||= Hostgroup.where(:name => _("Provision from %s") % @provisioner.fqdn).first_or_create
54
56
  @provisioner.subnet ||= Subnet.find_by_id(params['foreman_setup_provisioner']['subnet_attributes']['id'])
55
- domain_name = params['foreman_setup_provisioner'].delete('domain_name')
57
+ domain_name = provisioner_params['domain_name']
56
58
  @provisioner.domain = Domain.find_by_name(domain_name)
57
59
  @provisioner.domain ||= Domain.new(:name => domain_name)
58
60
 
59
- if @provisioner.update_attributes(params['foreman_setup_provisioner'])
61
+ if @provisioner.update_attributes(provisioner_params)
60
62
  @provisioner.subnet.domains << @provisioner.domain unless @provisioner.subnet.domains.include? @provisioner.domain
61
63
  process_success :success_msg => _("Successfully updated subnet %s.") % @provisioner.subnet.name, :success_redirect => step3_foreman_setup_provisioner_path
62
64
  else
@@ -98,7 +100,7 @@ module ForemanSetup
98
100
  warning msg unless status == 200
99
101
 
100
102
  @provisioner.hostgroup.medium ||= @provisioner.host.os.media.first
101
- @medium = Medium.new(params['foreman_setup_provisioner'].try(:[], 'medium_attributes'))
103
+ @medium = Medium.new(provisioner_params.try(:[], 'medium_attributes'))
102
104
  end
103
105
 
104
106
  def step4_update
@@ -107,7 +109,7 @@ module ForemanSetup
107
109
  @medium = Medium.find(medium_id) || raise('unable to find medium')
108
110
  else
109
111
  @provisioner.hostgroup.medium_id = nil
110
- @medium = Medium.new(params['foreman_setup_provisioner']['create_medium'].slice(:name, :path))
112
+ @medium = Medium.new(provisioner_params['create_medium'].slice(:name, :path))
111
113
  end
112
114
 
113
115
  # Associate medium with the host OS
@@ -176,5 +178,26 @@ module ForemanSetup
176
178
  @provisioner = Provisioner.authorized(:edit_provisioning).find(params[:id]) or raise('unknown id')
177
179
  end
178
180
 
181
+ def provisioner_params
182
+ @provisioner_params ||=
183
+ begin
184
+ medium_attrs = self.class.medium_params_filter.filter(parameter_filter_context)
185
+ subnet_attrs = self.class.subnet_params_filter.filter(parameter_filter_context)
186
+
187
+ params.permit(:'foreman_setup_provisioner' => [
188
+ :domain_name,
189
+ :host,
190
+ :host_id,
191
+ :provision_interface,
192
+ :smart_proxy,
193
+ :smart_proxy_id,
194
+ :subnet,
195
+ :create_medium => medium_attrs,
196
+ :hostgroup_attributes => [:id],
197
+ :medium_attributes => medium_attrs,
198
+ :subnet_attributes => subnet_attrs,
199
+ ])['foreman_setup_provisioner']
200
+ end
201
+ end
179
202
  end
180
203
  end
@@ -5,8 +5,6 @@ module ForemanSetup
5
5
  include ::Authorizable
6
6
  include ::Host::Hostmix
7
7
 
8
- attr_accessible :host, :smart_proxy, :host_id, :smart_proxy_id, :provision_interface, :domain_name, :subnet, :subnet_attributes
9
-
10
8
  before_save :populate_hostgroup
11
9
 
12
10
  belongs_to_host
@@ -16,7 +16,7 @@ module ForemanSetup
16
16
 
17
17
  initializer 'foreman_setup.register_plugin', :before => :finisher_hook do |app|
18
18
  Foreman::Plugin.register :foreman_setup do
19
- requires_foreman '>= 1.12.0'
19
+ requires_foreman '>= 1.13.0'
20
20
 
21
21
  menu :top_menu, :provisioners, :url_hash => {:controller=> :'foreman_setup/provisioners', :action=>:index},
22
22
  :caption=> N_('Provisioning setup'),
@@ -1,3 +1,3 @@
1
1
  module ForemanSetup
2
- VERSION = '4.0.0'
2
+ VERSION = '5.0.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_setup
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominic Cleal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-01 00:00:00.000000000 Z
11
+ date: 2016-08-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Plugin for Foreman that helps set up provisioning.
14
14
  email: dcleal@redhat.com