foreman_setup 3.0.2 → 3.1.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 +5 -0
- data/app/controllers/foreman_setup/provisioners_controller.rb +1 -1
- data/app/models/foreman_setup/provisioner.rb +2 -0
- data/app/views/foreman_setup/provisioners/_step2.html.erb +1 -1
- data/app/views/foreman_setup/provisioners/_step4.html.erb +1 -1
- data/lib/foreman_setup.rb +1 -1
- data/lib/foreman_setup/engine.rb +3 -1
- data/lib/foreman_setup/version.rb +1 -1
- data/lib/tasks/foreman_setup_tasks.rake +49 -0
- data/locale/ca/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/ca/foreman_setup.po +223 -0
- data/locale/de/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/de/foreman_setup.po +39 -38
- data/locale/en/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/en/foreman_setup.po +1 -1
- data/locale/en_GB/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/en_GB/foreman_setup.po +63 -62
- data/locale/es/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/es/foreman_setup.po +3 -3
- data/locale/fr/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/fr/foreman_setup.po +21 -21
- data/locale/it/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/it/foreman_setup.po +2 -2
- data/locale/ja/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/ja/foreman_setup.po +49 -48
- data/locale/ko/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/ko/foreman_setup.po +4 -4
- data/locale/pt_BR/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/pt_BR/foreman_setup.po +31 -29
- data/locale/ru/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/ru/foreman_setup.po +56 -55
- data/locale/sv_SE/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/sv_SE/foreman_setup.po +3 -3
- data/locale/zh_CN/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/zh_CN/foreman_setup.po +2 -2
- data/locale/zh_TW/LC_MESSAGES/foreman_setup.mo +0 -0
- data/locale/zh_TW/foreman_setup.po +2 -2
- data/test/factories/provisioners.rb +37 -0
- data/test/functional/foreman_setup/provisioners_controller_test.rb +150 -0
- data/test/test_plugin_helper.rb +6 -0
- data/test/unit/foreman_setup/provisioner_test.rb +13 -0
- metadata +13 -7
Binary file
|
@@ -6,12 +6,12 @@
|
|
6
6
|
# johnny.westerlund <johnny.westerlund@gmail.com>, 2014
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version: foreman_setup
|
9
|
+
"Project-Id-Version: foreman_setup 3.0.2\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
11
|
"POT-Creation-Date: 2014-08-20 09:25+0100\n"
|
12
|
-
"PO-Revision-Date:
|
12
|
+
"PO-Revision-Date: 2015-01-21 10:56+0000\n"
|
13
13
|
"Last-Translator: johnny.westerlund <johnny.westerlund@gmail.com>\n"
|
14
|
-
"Language-Team: Swedish (Sweden) (http://www.transifex.com/
|
14
|
+
"Language-Team: Swedish (Sweden) (http://www.transifex.com/foreman/foreman/language/sv_SE/)\n"
|
15
15
|
"MIME-Version: 1.0\n"
|
16
16
|
"Content-Type: text/plain; charset=UTF-8\n"
|
17
17
|
"Content-Transfer-Encoding: 8bit\n"
|
Binary file
|
@@ -5,12 +5,12 @@
|
|
5
5
|
# Translators:
|
6
6
|
msgid ""
|
7
7
|
msgstr ""
|
8
|
-
"Project-Id-Version: foreman_setup
|
8
|
+
"Project-Id-Version: foreman_setup 3.0.2\n"
|
9
9
|
"Report-Msgid-Bugs-To: \n"
|
10
10
|
"POT-Creation-Date: 2014-08-20 09:25+0100\n"
|
11
11
|
"PO-Revision-Date: 2014-08-20 08:30+0000\n"
|
12
12
|
"Last-Translator: Dominic Cleal <dcleal@redhat.com>\n"
|
13
|
-
"Language-Team: Chinese (China) (http://www.transifex.com/
|
13
|
+
"Language-Team: Chinese (China) (http://www.transifex.com/foreman/foreman/language/zh_CN/)\n"
|
14
14
|
"MIME-Version: 1.0\n"
|
15
15
|
"Content-Type: text/plain; charset=UTF-8\n"
|
16
16
|
"Content-Transfer-Encoding: 8bit\n"
|
Binary file
|
@@ -5,12 +5,12 @@
|
|
5
5
|
# Translators:
|
6
6
|
msgid ""
|
7
7
|
msgstr ""
|
8
|
-
"Project-Id-Version: foreman_setup
|
8
|
+
"Project-Id-Version: foreman_setup 3.0.2\n"
|
9
9
|
"Report-Msgid-Bugs-To: \n"
|
10
10
|
"POT-Creation-Date: 2014-08-20 09:25+0100\n"
|
11
11
|
"PO-Revision-Date: 2014-08-20 08:30+0000\n"
|
12
12
|
"Last-Translator: Dominic Cleal <dcleal@redhat.com>\n"
|
13
|
-
"Language-Team: Chinese (Taiwan) (http://www.transifex.com/
|
13
|
+
"Language-Team: Chinese (Taiwan) (http://www.transifex.com/foreman/foreman/language/zh_TW/)\n"
|
14
14
|
"MIME-Version: 1.0\n"
|
15
15
|
"Content-Type: text/plain; charset=UTF-8\n"
|
16
16
|
"Content-Transfer-Encoding: 8bit\n"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :setup_provisioner, :class => ForemanSetup::Provisioner do
|
3
|
+
host do
|
4
|
+
association :host, :with_puppet_orchestration, :domain => FactoryGirl.create(:domain)
|
5
|
+
end
|
6
|
+
smart_proxy { association :smart_proxy, :url => "https://#{host.name}:8443" }
|
7
|
+
|
8
|
+
# After step1, interface selection
|
9
|
+
trait :step1 do
|
10
|
+
provision_interface 'eth0'
|
11
|
+
after(:create) do |prov, evaluator|
|
12
|
+
fact = FactoryGirl.create(:fact_name, :name => "ipaddress_#{prov.provision_interface}")
|
13
|
+
FactoryGirl.create(:fact_value, :fact_name => fact, :host => prov.host, :value => '192.168.1.20')
|
14
|
+
|
15
|
+
fact = FactoryGirl.create(:fact_name, :name => "network_#{prov.provision_interface}")
|
16
|
+
FactoryGirl.create(:fact_value, :fact_name => fact, :host => prov.host, :value => '192.168.1.0')
|
17
|
+
|
18
|
+
fact = FactoryGirl.create(:fact_name, :name => "netmask_#{prov.provision_interface}")
|
19
|
+
FactoryGirl.create(:fact_value, :fact_name => fact, :host => prov.host, :value => '255.255.255.0')
|
20
|
+
|
21
|
+
fact = FactoryGirl.create(:fact_name, :name => 'interfaces')
|
22
|
+
FactoryGirl.create(:fact_value, :fact_name => fact, :host => prov.host, :value => 'lo,eth0,eth1')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# After step2_update, update with nested subnet data
|
27
|
+
trait :step2 do
|
28
|
+
step1
|
29
|
+
hostgroup
|
30
|
+
domain
|
31
|
+
subnet
|
32
|
+
after(:create) do |prov, evaluator|
|
33
|
+
prov.subnet.domains << prov.domain
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
|
3
|
+
class ForemanSetup::ProvisionersControllerTest < ActionController::TestCase
|
4
|
+
test '#index without provisioner' do
|
5
|
+
get :index, {}, set_session_user
|
6
|
+
assert_redirected_to new_foreman_setup_provisioner_path
|
7
|
+
end
|
8
|
+
|
9
|
+
test '#index with provisioner' do
|
10
|
+
FactoryGirl.create :setup_provisioner
|
11
|
+
get :index, {}, set_session_user
|
12
|
+
assert_response :success
|
13
|
+
assert_template 'foreman_setup/provisioners/index'
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'pre-creation' do
|
17
|
+
setup do
|
18
|
+
@host = FactoryGirl.create(:host, :domain => FactoryGirl.create(:domain))
|
19
|
+
Facter.expects(:value).with(:fqdn).returns(@host.name).at_least_once
|
20
|
+
@proxy = FactoryGirl.create(:smart_proxy, :url => "https://#{@host.name}:8443")
|
21
|
+
end
|
22
|
+
|
23
|
+
test '#new' do
|
24
|
+
get :new, {}, set_session_user
|
25
|
+
assert_response :success
|
26
|
+
assert_equal @host, assigns(:host)
|
27
|
+
assert_equal @proxy, assigns(:proxy)
|
28
|
+
assert_template 'foreman_setup/provisioners/_step1'
|
29
|
+
end
|
30
|
+
|
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
|
33
|
+
|
34
|
+
prov = ForemanSetup::Provisioner.find_by_host_id(@host.id)
|
35
|
+
assert prov
|
36
|
+
assert_equal @host, prov.host
|
37
|
+
assert_equal @proxy, prov.smart_proxy
|
38
|
+
assert_equal 'eth0', prov.provision_interface
|
39
|
+
|
40
|
+
assert_redirected_to step2_foreman_setup_provisioner_path(prov)
|
41
|
+
end
|
42
|
+
|
43
|
+
test '#create failure' do
|
44
|
+
post :create, {}, set_session_user
|
45
|
+
assert_equal @host, assigns(:host)
|
46
|
+
assert_equal @proxy, assigns(:proxy)
|
47
|
+
assert_template 'foreman_setup/provisioners/_step1'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
test '#step2 with new subnet' do
|
52
|
+
prov = FactoryGirl.create(:setup_provisioner, :step1)
|
53
|
+
get :step2, {:id => prov.id}, set_session_user
|
54
|
+
assert_response :success
|
55
|
+
assert_template 'foreman_setup/provisioners/_step2'
|
56
|
+
|
57
|
+
assert assigns(:provisioner).subnet.new_record?
|
58
|
+
assert_equal '192.168.1.0', assigns(:provisioner).subnet.network
|
59
|
+
assert_equal '255.255.255.0', assigns(:provisioner).subnet.mask
|
60
|
+
assert_equal '192.168.1.20', assigns(:provisioner).subnet.dns_primary
|
61
|
+
|
62
|
+
assert_equal prov.host.domain, assigns(:provisioner).domain
|
63
|
+
end
|
64
|
+
|
65
|
+
test '#step2_update' do
|
66
|
+
prov = FactoryGirl.create(:setup_provisioner, :step1)
|
67
|
+
Facter.expects(:value).with(:fqdn).returns(prov.host.name).at_least_once
|
68
|
+
|
69
|
+
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
|
70
|
+
assert_redirected_to step3_foreman_setup_provisioner_path(prov)
|
71
|
+
|
72
|
+
prov.reload
|
73
|
+
|
74
|
+
# Check new hg was created
|
75
|
+
assert Hostgroup.find_by_name("Provision from #{prov.host.name}")
|
76
|
+
assert prov.hostgroup
|
77
|
+
|
78
|
+
# Check nested subnet was created and saved
|
79
|
+
subnet = Subnet.find_by_network('192.168.1.0')
|
80
|
+
assert subnet
|
81
|
+
assert_equal 'test', subnet.name
|
82
|
+
assert prov.subnet
|
83
|
+
|
84
|
+
# Check domain was saved
|
85
|
+
assert_equal prov.host.domain, prov.domain
|
86
|
+
|
87
|
+
# Check domain/subnet association
|
88
|
+
assert_includes prov.domain.subnets, subnet
|
89
|
+
end
|
90
|
+
|
91
|
+
test '#step3' do
|
92
|
+
prov = FactoryGirl.create(:setup_provisioner, :step2)
|
93
|
+
get :step3, {:id => prov.id}, set_session_user
|
94
|
+
assert_response :success
|
95
|
+
assert_template 'foreman_setup/provisioners/_step3'
|
96
|
+
end
|
97
|
+
|
98
|
+
test '#step4' do
|
99
|
+
prov = FactoryGirl.create(:setup_provisioner, :step2)
|
100
|
+
|
101
|
+
SmartProxy.any_instance.expects(:refresh)
|
102
|
+
prov.smart_proxy.features = Feature.where(:name => ['DNS', 'DHCP', 'TFTP'])
|
103
|
+
prov.smart_proxy.save!
|
104
|
+
|
105
|
+
ProvisioningTemplate.expects(:build_pxe_default).returns(200, 'Sucess')
|
106
|
+
|
107
|
+
get :step4, {:id => prov.id}, set_session_user
|
108
|
+
assert_response :success
|
109
|
+
assert_template 'foreman_setup/provisioners/_step4'
|
110
|
+
assert assigns(:medium)
|
111
|
+
|
112
|
+
prov.reload
|
113
|
+
|
114
|
+
# Check proxy feature-based assignments worked
|
115
|
+
assert_equal prov.smart_proxy.id, prov.subnet.dns_id
|
116
|
+
# assert_equal prov.smart_proxy.id, prov.domain.dns_id # BUG, not saved
|
117
|
+
assert_equal prov.smart_proxy.id, prov.subnet.dhcp_id
|
118
|
+
assert_equal prov.smart_proxy.id, prov.subnet.tftp_id
|
119
|
+
end
|
120
|
+
|
121
|
+
test '#step4_update' do
|
122
|
+
prov = FactoryGirl.create(:setup_provisioner, :step2)
|
123
|
+
|
124
|
+
attrs = {
|
125
|
+
:hostgroup_attributes => {},
|
126
|
+
:create_medium => {:name => 'test', :path => 'http://mirror.example.com'},
|
127
|
+
:activation_key => {},
|
128
|
+
:satellite_type => {},
|
129
|
+
}
|
130
|
+
put :step4_update, {:id => prov.id, 'foreman_setup_provisioner' => attrs}, set_session_user
|
131
|
+
assert_redirected_to step5_foreman_setup_provisioner_path(prov)
|
132
|
+
|
133
|
+
prov.reload
|
134
|
+
|
135
|
+
assert prov.hostgroup.medium
|
136
|
+
assert_equal 'test', prov.hostgroup.medium.name
|
137
|
+
assert_equal 'http://mirror.example.com', prov.hostgroup.medium.path
|
138
|
+
|
139
|
+
assert prov.hostgroup.ptable
|
140
|
+
|
141
|
+
# TODO: assert that the OS and templates are all correctly associated
|
142
|
+
end
|
143
|
+
|
144
|
+
test '#step5' do
|
145
|
+
prov = FactoryGirl.create(:setup_provisioner, :step2)
|
146
|
+
get :step5, {:id => prov.id}, set_session_user
|
147
|
+
assert_response :success
|
148
|
+
assert_template 'foreman_setup/provisioners/_step5'
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ForemanSetupProvisionerTest < ActiveSupport::TestCase
|
4
|
+
test '#interfaces returns hash' do
|
5
|
+
prov = FactoryGirl.create(:setup_provisioner, :step1)
|
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
|
+
end
|
8
|
+
|
9
|
+
test '#provision_interface_data returns hash' do
|
10
|
+
prov = FactoryGirl.create(:setup_provisioner, :step1)
|
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
|
+
end
|
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: 3.0
|
4
|
+
version: 3.1.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:
|
11
|
+
date: 2016-01-06 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
|
@@ -19,7 +19,7 @@ extra_rdoc_files:
|
|
19
19
|
- LICENSE
|
20
20
|
- README.md
|
21
21
|
files:
|
22
|
-
-
|
22
|
+
- .tx/config
|
23
23
|
- CHANGES.md
|
24
24
|
- LICENSE
|
25
25
|
- README.md
|
@@ -46,7 +46,10 @@ files:
|
|
46
46
|
- lib/foreman_setup.rb
|
47
47
|
- lib/foreman_setup/engine.rb
|
48
48
|
- lib/foreman_setup/version.rb
|
49
|
+
- lib/tasks/foreman_setup_tasks.rake
|
49
50
|
- locale/Makefile
|
51
|
+
- locale/ca/LC_MESSAGES/foreman_setup.mo
|
52
|
+
- locale/ca/foreman_setup.po
|
50
53
|
- locale/de/LC_MESSAGES/foreman_setup.mo
|
51
54
|
- locale/de/foreman_setup.po
|
52
55
|
- locale/en/LC_MESSAGES/foreman_setup.mo
|
@@ -75,6 +78,10 @@ files:
|
|
75
78
|
- locale/zh_CN/foreman_setup.po
|
76
79
|
- locale/zh_TW/LC_MESSAGES/foreman_setup.mo
|
77
80
|
- locale/zh_TW/foreman_setup.po
|
81
|
+
- test/factories/provisioners.rb
|
82
|
+
- test/functional/foreman_setup/provisioners_controller_test.rb
|
83
|
+
- test/test_plugin_helper.rb
|
84
|
+
- test/unit/foreman_setup/provisioner_test.rb
|
78
85
|
homepage: http://github.com/theforeman/foreman_setup
|
79
86
|
licenses:
|
80
87
|
- GPL-3
|
@@ -85,19 +92,18 @@ require_paths:
|
|
85
92
|
- lib
|
86
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
94
|
requirements:
|
88
|
-
- -
|
95
|
+
- - '>='
|
89
96
|
- !ruby/object:Gem::Version
|
90
97
|
version: '0'
|
91
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
99
|
requirements:
|
93
|
-
- -
|
100
|
+
- - '>='
|
94
101
|
- !ruby/object:Gem::Version
|
95
102
|
version: '0'
|
96
103
|
requirements: []
|
97
104
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.4.
|
105
|
+
rubygems_version: 2.4.4
|
99
106
|
signing_key:
|
100
107
|
specification_version: 4
|
101
108
|
summary: Helps set up Foreman for provisioning
|
102
109
|
test_files: []
|
103
|
-
has_rdoc:
|