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 +4 -4
- data/CHANGES.md +3 -0
- data/README.md +1 -0
- data/app/controllers/foreman_setup/provisioners_controller.rb +28 -5
- data/app/models/foreman_setup/provisioner.rb +0 -2
- data/lib/foreman_setup/engine.rb +1 -1
- data/lib/foreman_setup/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5a8af59d427af8214977639e543c4cd4f4fa5f1
|
4
|
+
data.tar.gz: 68f2949405814f9f0cb1009c9cfc0303c3a4965a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ae2f7c5df551c5640faa48e72ed4fc44006d9bb7fa773060c2461f3ae71cf66907b3eddd01b585c13bd94bdd22cf67a9ee8cdf00adf9c2c2d8695ebaec7ad90
|
7
|
+
data.tar.gz: 93eb0b0da19d50b86dfef0630d32ba86b86f051acc048e2e466cbc7c22dbebf4810c436f54b4d73875f6645dac00e8186e87964179e04de1651da5c947d24479
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -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(
|
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 =
|
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(
|
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(
|
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(
|
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
|
data/lib/foreman_setup/engine.rb
CHANGED
@@ -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.
|
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'),
|
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
|
+
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-
|
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
|