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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 490654bc557051d61752f5245a69a2c2d3b0c077
4
- data.tar.gz: d5ba8f8ba082ecc4f10ed8f09229bd8e7b59b1f3
3
+ metadata.gz: 265e5e20854aca25723e6d136a77872a9403e619
4
+ data.tar.gz: 826ed0175831b84322318168f697db596826da52
5
5
  SHA512:
6
- metadata.gz: bb3856fb4f5da2a16cc77dbc21d1fc8d46d2357d95880b6917aaa21f0190b2c0f52b44d9251556eefc66d852aa94dae89a9b7e1b376230e4579fb8723d00d353
7
- data.tar.gz: cf09e5f85600f03e33e578c5471f7049dc75cefb3f5d706f46575d95df3092789e581d0e8d245e1f7958b4c0b8294afde01654d8bb1d14b21e86969443386df8
6
+ metadata.gz: b943cc4e4845b66fee1f77200f6d1d8f13706ccad09daef25e87bf00b2f91858c5f3e09a3045ec68a6be6e6b2afea214bf1e42bd4f49c4a6fb8c729281b92f81
7
+ data.tar.gz: 5e9a61714ac9562814ffebf561ff8ab3e5fc9f925ce96e2ec4d89a803f99ad99dc5a4736997961aef8859a5b17aa056047eecc9c97a12604a5cf4919aa6d11e7
data/CHANGES.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## v6.0.0
4
+ * fix Foreman 1.17 compatibility with Rails 5
5
+
3
6
  ## v5.0.1
4
7
  * use case-insensitive OS family comparisons
5
8
  * change Katello installer commands
data/README.md CHANGED
@@ -25,6 +25,7 @@ RPM users can install the "tfm-rubygem-foreman_setup" or
25
25
  | >= 1.9 | ~> 3.0 |
26
26
  | >= 1.12 | ~> 4.0 |
27
27
  | >= 1.13 | ~> 5.0 |
28
+ | >= 1.17 | ~> 6.0 |
28
29
 
29
30
  # Areas this should help
30
31
 
@@ -7,8 +7,8 @@ module ForemanSetup
7
7
  include Foreman::Controller::Parameters::Subnet
8
8
  include Foreman::Renderer
9
9
 
10
- before_filter :find_myself, :only => [:new, :create]
11
- before_filter :find_resource, :except => [:index, :new, :create]
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,7 +1,7 @@
1
1
  require 'ipaddr'
2
2
 
3
3
  module ForemanSetup
4
- class Provisioner < ActiveRecord::Base
4
+ class Provisioner < ApplicationRecord
5
5
  include ::Authorizable
6
6
  include ::Host::Hostmix
7
7
 
@@ -1,4 +1,4 @@
1
- class AddProvisioners < ActiveRecord::Migration
1
+ class AddProvisioners < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :setup_provisioners do |t|
4
4
  t.integer :host_id
@@ -1,4 +1,4 @@
1
- class AddProvisionersHostgroup < ActiveRecord::Migration
1
+ class AddProvisionersHostgroup < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :setup_provisioners, :hostgroup_id, :integer
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddProvisionersDomain < ActiveRecord::Migration
1
+ class AddProvisionersDomain < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :setup_provisioners, :domain_id, :integer
4
4
  end
@@ -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
@@ -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.13.0'
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,3 +1,3 @@
1
1
  module ForemanSetup
2
- VERSION = '5.0.1'
2
+ VERSION = '6.0.0'
3
3
  end
@@ -1,7 +1,7 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :setup_provisioner, :class => ForemanSetup::Provisioner do
3
3
  host do
4
- association :host, :with_puppet_orchestration, :domain => FactoryGirl.create(: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 = 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')
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 = 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')
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 = 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')
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 = FactoryGirl.create(:fact_name, :name => 'interfaces')
22
- FactoryGirl.create(:fact_value, :fact_name => fact, :host => prov.host, :value => 'lo,eth0,eth1')
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, {}, set_session_user
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
- FactoryGirl.create :setup_provisioner
11
- get :index, {}, set_session_user
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 = FactoryGirl.create(:host, :domain => FactoryGirl.create(:domain))
18
+ @host = FactoryBot.create(:host, :domain => FactoryBot.create(:domain))
19
19
  Facter.expects(:value).with(:fqdn).returns(@host.name).at_least_once
20
- @proxy = FactoryGirl.create(:smart_proxy, :url => "https://#{@host.name}:8443")
20
+ @proxy = FactoryBot.create(:smart_proxy, :url => "https://#{@host.name}:8443")
21
21
  end
22
22
 
23
23
  test '#new' do
24
- get :new, {}, set_session_user
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, {}, set_session_user
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 = FactoryGirl.create(:setup_provisioner, :step1)
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 = FactoryGirl.create(:setup_provisioner, :step1)
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 = FactoryGirl.create(:setup_provisioner, :step2)
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 = FactoryGirl.create(:setup_provisioner, :step2)
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 = FactoryGirl.create(:setup_provisioner, :step2)
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 = FactoryGirl.create(:setup_provisioner, :step2)
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
@@ -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 FactoryGirl's paths
5
- FactoryGirl.definition_file_paths << File.join(File.dirname(__FILE__), 'factories')
6
- FactoryGirl.reload
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 = FactoryGirl.create(:setup_provisioner, :step1)
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 = FactoryGirl.create(:setup_provisioner, :step1)
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: 5.0.1
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-10-15 00:00:00.000000000 Z
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