foreman_setup 5.0.1 → 6.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 +2 -2
- data/app/models/foreman_setup/provisioner.rb +1 -1
- data/db/migrate/20131023140100_add_provisioners.rb +1 -1
- data/db/migrate/20131025180600_add_provisioners_hostgroup.rb +1 -1
- data/db/migrate/20131028161000_add_provisioners_domain.rb +1 -1
- data/db/migrate/20140305165000_update_foreman_setup_permissions.rb +1 -1
- data/lib/foreman_setup/engine.rb +1 -1
- data/lib/foreman_setup/version.rb +1 -1
- data/test/factories/provisioners.rb +10 -10
- data/test/functional/foreman_setup/provisioners_controller_test.rb +20 -20
- data/test/test_plugin_helper.rb +3 -3
- data/test/unit/foreman_setup/provisioner_test.rb +2 -2
- 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: 265e5e20854aca25723e6d136a77872a9403e619
|
4
|
+
data.tar.gz: 826ed0175831b84322318168f697db596826da52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b943cc4e4845b66fee1f77200f6d1d8f13706ccad09daef25e87bf00b2f91858c5f3e09a3045ec68a6be6e6b2afea214bf1e42bd4f49c4a6fb8c729281b92f81
|
7
|
+
data.tar.gz: 5e9a61714ac9562814ffebf561ff8ab3e5fc9f925ce96e2ec4d89a803f99ad99dc5a4736997961aef8859a5b17aa056047eecc9c97a12604a5cf4919aa6d11e7
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -7,8 +7,8 @@ module ForemanSetup
|
|
7
7
|
include Foreman::Controller::Parameters::Subnet
|
8
8
|
include Foreman::Renderer
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
before_action :find_myself, :only => [:new, :create]
|
11
|
+
before_action :find_resource, :except => [:index, :new, :create]
|
12
12
|
|
13
13
|
def index
|
14
14
|
@provisioners = Provisioner.all.paginate :page => params[:page]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class UpdateForemanSetupPermissions < ActiveRecord::Migration
|
1
|
+
class UpdateForemanSetupPermissions < ActiveRecord::Migration[4.2]
|
2
2
|
def self.up
|
3
3
|
old_permission = ::Permission.where(:name => "edit_provisioning", :resource_type => nil).first
|
4
4
|
new_permission = ::Permission.where(:name => "edit_provisioning", :resource_type => "ForemanSetup::Provisioner").first
|
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.17.0'
|
20
20
|
|
21
21
|
menu :top_menu, :provisioners, :url_hash => {:controller=> :'foreman_setup/provisioners', :action=>:index},
|
22
22
|
:caption=> N_('Provisioning setup'),
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
factory :setup_provisioner, :class => ForemanSetup::Provisioner do
|
3
3
|
host do
|
4
|
-
association :host, :with_puppet_orchestration, :domain =>
|
4
|
+
association :host, :with_puppet_orchestration, :domain => FactoryBot.create(:domain)
|
5
5
|
end
|
6
6
|
smart_proxy { association :smart_proxy, :url => "https://#{host.name}:8443" }
|
7
7
|
|
@@ -9,17 +9,17 @@ FactoryGirl.define do
|
|
9
9
|
trait :step1 do
|
10
10
|
provision_interface 'eth0'
|
11
11
|
after(:create) do |prov, evaluator|
|
12
|
-
fact =
|
13
|
-
|
12
|
+
fact = FactoryBot.create(:fact_name, :name => "ipaddress_#{prov.provision_interface}")
|
13
|
+
FactoryBot.create(:fact_value, :fact_name => fact, :host => prov.host, :value => '192.168.1.20')
|
14
14
|
|
15
|
-
fact =
|
16
|
-
|
15
|
+
fact = FactoryBot.create(:fact_name, :name => "network_#{prov.provision_interface}")
|
16
|
+
FactoryBot.create(:fact_value, :fact_name => fact, :host => prov.host, :value => '192.168.1.0')
|
17
17
|
|
18
|
-
fact =
|
19
|
-
|
18
|
+
fact = FactoryBot.create(:fact_name, :name => "netmask_#{prov.provision_interface}")
|
19
|
+
FactoryBot.create(:fact_value, :fact_name => fact, :host => prov.host, :value => '255.255.255.0')
|
20
20
|
|
21
|
-
fact =
|
22
|
-
|
21
|
+
fact = FactoryBot.create(:fact_name, :name => 'interfaces')
|
22
|
+
FactoryBot.create(:fact_value, :fact_name => fact, :host => prov.host, :value => 'lo,eth0,eth1')
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -2,26 +2,26 @@ require 'test_plugin_helper'
|
|
2
2
|
|
3
3
|
class ForemanSetup::ProvisionersControllerTest < ActionController::TestCase
|
4
4
|
test '#index without provisioner' do
|
5
|
-
get :index,
|
5
|
+
get :index, headers: set_session_user
|
6
6
|
assert_redirected_to new_foreman_setup_provisioner_path
|
7
7
|
end
|
8
8
|
|
9
9
|
test '#index with provisioner' do
|
10
|
-
|
11
|
-
get :index,
|
10
|
+
FactoryBot.create :setup_provisioner
|
11
|
+
get :index, session: set_session_user
|
12
12
|
assert_response :success
|
13
13
|
assert_template 'foreman_setup/provisioners/index'
|
14
14
|
end
|
15
15
|
|
16
16
|
context 'pre-creation' do
|
17
17
|
setup do
|
18
|
-
@host =
|
18
|
+
@host = FactoryBot.create(:host, :domain => FactoryBot.create(:domain))
|
19
19
|
Facter.expects(:value).with(:fqdn).returns(@host.name).at_least_once
|
20
|
-
@proxy =
|
20
|
+
@proxy = FactoryBot.create(:smart_proxy, :url => "https://#{@host.name}:8443")
|
21
21
|
end
|
22
22
|
|
23
23
|
test '#new' do
|
24
|
-
get :new,
|
24
|
+
get :new, session: set_session_user
|
25
25
|
assert_response :success
|
26
26
|
assert_equal @host, assigns(:host)
|
27
27
|
assert_equal @proxy, assigns(:proxy)
|
@@ -29,7 +29,7 @@ class ForemanSetup::ProvisionersControllerTest < ActionController::TestCase
|
|
29
29
|
end
|
30
30
|
|
31
31
|
test '#create success' do
|
32
|
-
post :create, {'foreman_setup_provisioner' => {:host_id => @host.id, :smart_proxy_id => @proxy.id, :provision_interface => 'eth0'}}, set_session_user
|
32
|
+
post :create, params: { 'foreman_setup_provisioner' => {:host_id => @host.id, :smart_proxy_id => @proxy.id, :provision_interface => 'eth0'} }, session: set_session_user
|
33
33
|
|
34
34
|
prov = ForemanSetup::Provisioner.find_by_host_id(@host.id)
|
35
35
|
assert prov
|
@@ -43,7 +43,7 @@ class ForemanSetup::ProvisionersControllerTest < ActionController::TestCase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
test '#create failure' do
|
46
|
-
post :create,
|
46
|
+
post :create, session: set_session_user
|
47
47
|
assert_equal @host, assigns(:host)
|
48
48
|
assert_equal @proxy, assigns(:proxy)
|
49
49
|
assert_template 'foreman_setup/provisioners/_step1'
|
@@ -51,8 +51,8 @@ class ForemanSetup::ProvisionersControllerTest < ActionController::TestCase
|
|
51
51
|
end
|
52
52
|
|
53
53
|
test '#step2 with new subnet' do
|
54
|
-
prov =
|
55
|
-
get :step2, {:id => prov.id}, set_session_user
|
54
|
+
prov = FactoryBot.create(:setup_provisioner, :step1)
|
55
|
+
get :step2, params: { :id => prov.id }, session: set_session_user
|
56
56
|
assert_response :success
|
57
57
|
assert_template 'foreman_setup/provisioners/_step2'
|
58
58
|
|
@@ -65,10 +65,10 @@ class ForemanSetup::ProvisionersControllerTest < ActionController::TestCase
|
|
65
65
|
end
|
66
66
|
|
67
67
|
test '#step2_update' do
|
68
|
-
prov =
|
68
|
+
prov = FactoryBot.create(:setup_provisioner, :step1)
|
69
69
|
Facter.expects(:value).with(:fqdn).returns(prov.host.name).at_least_once
|
70
70
|
|
71
|
-
put :step2_update, {:id => prov.id, 'foreman_setup_provisioner' => {:subnet_attributes => {'name' => 'test', :network => '192.168.1.0', :mask => '255.255.255.0'}, :domain_name => prov.host.domain.name}}, set_session_user
|
71
|
+
put :step2_update, params: { :id => prov.id, 'foreman_setup_provisioner' => {:subnet_attributes => {'name' => 'test', :network => '192.168.1.0', :mask => '255.255.255.0'}, :domain_name => prov.host.domain.name} }, session: set_session_user
|
72
72
|
assert_redirected_to step3_foreman_setup_provisioner_path(prov)
|
73
73
|
|
74
74
|
as_admin do
|
@@ -93,14 +93,14 @@ class ForemanSetup::ProvisionersControllerTest < ActionController::TestCase
|
|
93
93
|
end
|
94
94
|
|
95
95
|
test '#step3' do
|
96
|
-
prov =
|
97
|
-
get :step3, {:id => prov.id}, set_session_user
|
96
|
+
prov = FactoryBot.create(:setup_provisioner, :step2)
|
97
|
+
get :step3, params: { :id => prov.id }, session: set_session_user
|
98
98
|
assert_response :success
|
99
99
|
assert_template 'foreman_setup/provisioners/_step3'
|
100
100
|
end
|
101
101
|
|
102
102
|
test '#step4' do
|
103
|
-
prov =
|
103
|
+
prov = FactoryBot.create(:setup_provisioner, :step2)
|
104
104
|
|
105
105
|
SmartProxy.any_instance.expects(:refresh)
|
106
106
|
prov.smart_proxy.features = Feature.where(:name => ['DNS', 'DHCP', 'TFTP'])
|
@@ -108,7 +108,7 @@ class ForemanSetup::ProvisionersControllerTest < ActionController::TestCase
|
|
108
108
|
|
109
109
|
ProvisioningTemplate.expects(:build_pxe_default).returns(200, 'Sucess')
|
110
110
|
|
111
|
-
get :step4, {:id => prov.id}, set_session_user
|
111
|
+
get :step4, params: { :id => prov.id }, session: set_session_user
|
112
112
|
assert_response :success
|
113
113
|
assert_template 'foreman_setup/provisioners/_step4'
|
114
114
|
assert assigns(:medium)
|
@@ -125,13 +125,13 @@ class ForemanSetup::ProvisionersControllerTest < ActionController::TestCase
|
|
125
125
|
end
|
126
126
|
|
127
127
|
test '#step4_update' do
|
128
|
-
prov =
|
128
|
+
prov = FactoryBot.create(:setup_provisioner, :step2)
|
129
129
|
|
130
130
|
attrs = {
|
131
131
|
:hostgroup_attributes => {},
|
132
132
|
:create_medium => {:name => 'test', :path => 'http://mirror.example.com'},
|
133
133
|
}
|
134
|
-
put :step4_update, {:id => prov.id, 'foreman_setup_provisioner' => attrs}, set_session_user
|
134
|
+
put :step4_update, params: { :id => prov.id, 'foreman_setup_provisioner' => attrs }, session: set_session_user
|
135
135
|
assert_redirected_to step5_foreman_setup_provisioner_path(prov)
|
136
136
|
|
137
137
|
as_admin do
|
@@ -148,8 +148,8 @@ class ForemanSetup::ProvisionersControllerTest < ActionController::TestCase
|
|
148
148
|
end
|
149
149
|
|
150
150
|
test '#step5' do
|
151
|
-
prov =
|
152
|
-
get :step5, {:id => prov.id}, set_session_user
|
151
|
+
prov = FactoryBot.create(:setup_provisioner, :step2)
|
152
|
+
get :step5, params: { :id => prov.id }, session: set_session_user
|
153
153
|
assert_response :success
|
154
154
|
assert_template 'foreman_setup/provisioners/_step5'
|
155
155
|
end
|
data/test/test_plugin_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This calls the main test_helper in Foreman core
|
2
2
|
require 'test_helper'
|
3
3
|
|
4
|
-
# Add plugin to
|
5
|
-
|
6
|
-
|
4
|
+
# Add plugin to FactoryBot's paths
|
5
|
+
FactoryBot.definition_file_paths << File.join(File.dirname(__FILE__), 'factories')
|
6
|
+
FactoryBot.reload
|
@@ -2,12 +2,12 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class ForemanSetupProvisionerTest < ActiveSupport::TestCase
|
4
4
|
test '#interfaces returns hash' do
|
5
|
-
prov =
|
5
|
+
prov = FactoryBot.create(:setup_provisioner, :step1)
|
6
6
|
assert_equal({'eth0' => {:ip => '192.168.1.20', :mask => '255.255.255.0', :network => '192.168.1.0', :cidr => '192.168.1.0/24'}}, prov.interfaces)
|
7
7
|
end
|
8
8
|
|
9
9
|
test '#provision_interface_data returns hash' do
|
10
|
-
prov =
|
10
|
+
prov = FactoryBot.create(:setup_provisioner, :step1)
|
11
11
|
assert_equal({:ip => '192.168.1.20', :mask => '255.255.255.0', :network => '192.168.1.0', :cidr => '192.168.1.0/24'}, prov.provision_interface_data)
|
12
12
|
end
|
13
13
|
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
|
+
version: 6.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: 2017-
|
11
|
+
date: 2017-12-26 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
|