foreman_bootdisk 10.0.2 → 11.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
  SHA256:
3
- metadata.gz: 8e1f729480f6663624d1fb96b994a381e9926c1d99f7239d02fca9a376d6ccaa
4
- data.tar.gz: e94de3dd4d1dd78abac381ca057e6da44a42e0a5f9b5afbd493c29ce6310861a
3
+ metadata.gz: 7090fb0dd77db85fc9aa172b0a785f2d97c37a3dc5597a689a5c79fd7fbd0f2a
4
+ data.tar.gz: d35862a0f641367cc7bfd1fa95a801e0ab5afd056b19995fa6f05aae97bf4bdd
5
5
  SHA512:
6
- metadata.gz: 15348dcc0e22146f014239eae49e90a0e4fd95050d44c42cab4ee461e165ea63f407b797c70001c49180d36c0fef47ca166aa01e26253d08ca2412b3cbeac7b0
7
- data.tar.gz: b3f5b11e82ed73e2d0c7373f61af61fd1b861c45e2399b02e010399d24139d89ded5ecaae5663d17b19fec370e9ccec592e3dff2734f2431c9f493291ad965a5
6
+ metadata.gz: c7c3a1e1f5e951b2252087d2064c9886a779a08c96a4c52d15c5d7711a542d5c9195e96bd86aecf2d82f780b633f11680c91368304d7874e8130b181e0f1606f
7
+ data.tar.gz: 278854b3bcfbd844c72d0c817e1479d47a47125f95f47cb2b08b7dc257f0ece53f73070296681952c7bfeced060329e30033bf021a371420727b3b942461fb92
data/CHANGES.md CHANGED
@@ -1,12 +1,11 @@
1
1
  # Changelog
2
2
 
3
- ## v10.0.2
3
+ ## v11.0.0
4
4
  * bootdisk_raise template marco works in preview mode (#22136)
5
5
  * host image works with subnet without gateway (#21106)
6
-
7
- ## v10.0.1
8
6
  * Fix rake tasks are Taxonomy and User aware (#21877)
9
- * Revert alias_method_chain with Module#prepend for Katello 3.4 compatibility
7
+ * database migrations support rails 5 (#21821)
8
+ * changes to support rails 5.1
10
9
 
11
10
  ## v10.0.0
12
11
  * retry vmware iso boot 10 times before giving up (#19013)
data/README.md CHANGED
@@ -45,6 +45,7 @@ gPXE images are unsupported due to lack of initrd support.
45
45
  | >= 1.12 | ~> 8.0 |
46
46
  | >= 1.13 | ~> 9.0 |
47
47
  | >= 1.15 | ~> 10.0 |
48
+ | >= 1.17 | ~> 11.0 |
48
49
 
49
50
  # Usage
50
51
 
@@ -1,12 +1,6 @@
1
1
  module ForemanBootdisk::UnattendedControllerExt
2
- extend ActiveSupport::Concern
3
-
4
- included do
5
- alias_method_chain :find_host_by_ip_or_mac, :param_mac
6
- end
7
-
8
- def find_host_by_ip_or_mac_with_param_mac
2
+ def find_host_by_ip_or_mac
9
3
  request.env['HTTP_X_RHN_PROVISIONING_MAC_0'] = "unknown #{params['mac']}" unless request.env.has_key?('HTTP_X_RHN_PROVISIONING_MAC_0') || params['mac'].nil?
10
- find_host_by_ip_or_mac_without_param_mac
4
+ super
11
5
  end
12
6
  end
@@ -9,7 +9,7 @@ module ForemanBootdisk
9
9
  tmpl = ForemanBootdisk::Renderer.new.generic_template_render
10
10
  rescue => e
11
11
  error_rendering(e)
12
- redirect_to :back
12
+ redirect_back(fallback_location: '/')
13
13
  return
14
14
  end
15
15
 
@@ -24,7 +24,7 @@ module ForemanBootdisk
24
24
  tmpl = host.bootdisk_template_render
25
25
  rescue => e
26
26
  error_rendering(e)
27
- redirect_to :back
27
+ redirect_back(fallback_location: '/')
28
28
  return
29
29
  end
30
30
 
@@ -48,7 +48,7 @@ module ForemanBootdisk
48
48
  tmpl = ForemanBootdisk::Renderer.new.generic_template_render(subnet)
49
49
  rescue => e
50
50
  error_rendering(e)
51
- redirect_to :back
51
+ redirect_back(fallback_location: '/')
52
52
  return
53
53
  end
54
54
 
@@ -1,11 +1,5 @@
1
1
  module ForemanBootdisk::HostsHelperExt
2
- extend ActiveSupport::Concern
3
-
4
- included do
5
- alias_method_chain :host_title_actions, :bootdisk
6
- end
7
-
8
- def host_title_actions_with_bootdisk(*args)
2
+ def host_title_actions(*args)
9
3
  if @host.bootdisk_downloadable?
10
4
  title_actions(
11
5
  button_group(
@@ -24,7 +18,7 @@ module ForemanBootdisk::HostsHelperExt
24
18
  bootdisk_button_disabled
25
19
  end
26
20
 
27
- host_title_actions_without_bootdisk(*args)
21
+ super
28
22
  end
29
23
 
30
24
  def bootdisk_button_disabled
@@ -1,19 +1,12 @@
1
1
  module ForemanBootdisk
2
2
  module ComputeResources
3
3
  module Vmware
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- alias_method_chain :capabilities, :bootdisk
8
- alias_method_chain :parse_args, :bootdisk
9
- end
10
-
11
- def capabilities_with_bootdisk
12
- capabilities_without_bootdisk + [:bootdisk]
4
+ def capabilities
5
+ super + [:bootdisk]
13
6
  end
14
7
 
15
- def parse_args_with_bootdisk(args = {})
16
- args = parse_args_without_bootdisk args
8
+ def parse_args(args = {})
9
+ args = super
17
10
  if args[:provision_method] == 'bootdisk'
18
11
  args[:cdroms] = [new_cdrom]
19
12
  args[:boot_order] = ['cdrom', 'disk']
@@ -1,13 +1,6 @@
1
1
  require 'uri'
2
2
 
3
3
  module ForemanBootdisk::HostExt
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- alias_method_chain :validate_media?, :bootdisk
8
- alias_method_chain :can_be_built?, :bootdisk
9
- end
10
-
11
4
  def bootdisk_template
12
5
  ProvisioningTemplate.unscoped.find_by_name(Setting[:bootdisk_host_template]) || raise(::Foreman::Exception.new(N_('Unable to find template specified by %s setting'), 'bootdisk_host_template'))
13
6
  end
@@ -37,11 +30,11 @@ module ForemanBootdisk::HostExt
37
30
  /i.86|x86[_-]64/ =~ architecture.name
38
31
  end
39
32
 
40
- def validate_media_with_bootdisk?
41
- validate_media_without_bootdisk? || (managed && bootdisk_build? && build?)
33
+ def validate_media?
34
+ super || (managed && bootdisk_build? && build?)
42
35
  end
43
36
 
44
- def can_be_built_with_bootdisk?
45
- can_be_built_without_bootdisk? || (managed? and SETTINGS[:unattended] and bootdisk_build? and !build?)
37
+ def can_be_built?
38
+ super || (managed? and SETTINGS[:unattended] and bootdisk_build? and !build?)
46
39
  end
47
40
  end
@@ -1,6 +1,6 @@
1
1
  class Setting::Bootdisk< ::Setting
2
2
  def self.load_defaults
3
- return unless ActiveRecord::Base.connection.table_exists?('settings')
3
+ return unless ApplicationRecord.connection.table_exists?('settings')
4
4
  return unless super
5
5
 
6
6
  ipxe = ['/usr/lib/ipxe'].find { |p| File.exist?(p) } || '/usr/share/ipxe'
@@ -1,4 +1,4 @@
1
- class CreateHostBootdiskTemplate < ActiveRecord::Migration
1
+ class CreateHostBootdiskTemplate < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  end
4
4
 
@@ -1,4 +1,4 @@
1
- class EditHostBootdiskTemplateMultinic < ActiveRecord::Migration
1
+ class EditHostBootdiskTemplateMultinic < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  end
4
4
 
@@ -1,4 +1,4 @@
1
- class CreateKickstartBootdiskTemplate < ActiveRecord::Migration
1
+ class CreateKickstartBootdiskTemplate < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  end
4
4
 
@@ -1,4 +1,4 @@
1
- class CreateGenericHostBootdiskTemplate < ActiveRecord::Migration
1
+ class CreateGenericHostBootdiskTemplate < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  end
4
4
 
@@ -1,4 +1,4 @@
1
- class EditHostBootdiskTemplateDnsSecondary < ActiveRecord::Migration
1
+ class EditHostBootdiskTemplateDnsSecondary < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  end
4
4
 
@@ -1,5 +1,5 @@
1
- class ChangeTemplatekindToBootdisk < ActiveRecord::Migration
2
- class FakeConfigTemplate < ActiveRecord::Base
1
+ class ChangeTemplatekindToBootdisk < ActiveRecord::Migration[4.2]
2
+ class FakeConfigTemplate < ApplicationRecord
3
3
  if ActiveRecord::Migrator.get_all_versions.include?(20150514072626)
4
4
  self.table_name = 'templates'
5
5
  else
@@ -1,4 +1,4 @@
1
- class RemoveDuplicateBootdiskTemplates < ActiveRecord::Migration
1
+ class RemoveDuplicateBootdiskTemplates < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  template_names = ['Boot disk iPXE - host', 'Boot disk iPXE - generic host']
4
4
  template_names.each do |template_name|
@@ -48,7 +48,7 @@ module ForemanBootdisk
48
48
 
49
49
  initializer 'foreman_bootdisk.register_plugin', :before => :finisher_hook do |app|
50
50
  Foreman::Plugin.register :foreman_bootdisk do
51
- requires_foreman '>= 1.15'
51
+ requires_foreman '>= 1.17'
52
52
 
53
53
  security_block :bootdisk do |map|
54
54
  permission :download_bootdisk, {:'foreman_bootdisk/disks' => [:generic, :host, :full_host, :subnet, :help],
@@ -76,11 +76,11 @@ module ForemanBootdisk
76
76
 
77
77
  config.to_prepare do
78
78
  begin
79
- Host::Managed.send(:include, ForemanBootdisk::HostExt)
79
+ Host::Managed.send(:prepend, ForemanBootdisk::HostExt)
80
80
  Host::Managed.send(:include, ForemanBootdisk::Orchestration::Compute) if SETTINGS[:unattended]
81
- HostsHelper.send(:include, ForemanBootdisk::HostsHelperExt)
82
- UnattendedController.send(:include, ForemanBootdisk::UnattendedControllerExt)
83
- Foreman::Model::Vmware.send(:include, ForemanBootdisk::ComputeResources::Vmware) if Foreman::Model::Vmware.available?
81
+ HostsHelper.send(:prepend, ForemanBootdisk::HostsHelperExt)
82
+ UnattendedController.send(:prepend, ForemanBootdisk::UnattendedControllerExt)
83
+ Foreman::Model::Vmware.send(:prepend, ForemanBootdisk::ComputeResources::Vmware) if Foreman::Model::Vmware.available?
84
84
  rescue => e
85
85
  puts "#{ForemanBootdisk::ENGINE_NAME}: skipping engine hook (#{e.to_s})"
86
86
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanBootdisk
2
- VERSION = '10.0.2'
2
+ VERSION = '11.0.0'
3
3
  end
@@ -7,7 +7,7 @@ class ForemanBootdisk::Api::V2::DisksControllerTest < ActionController::TestCase
7
7
  test "should generate generic image" do
8
8
  ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk generic host template/))).yields("temp ISO")
9
9
  @controller.expects(:read_file).with("temp ISO").returns("ISO image")
10
- get :generic, {}
10
+ get :generic
11
11
  assert_response :success
12
12
  assert_equal "ISO image", @response.body
13
13
  end
@@ -19,7 +19,7 @@ class ForemanBootdisk::Api::V2::DisksControllerTest < ActionController::TestCase
19
19
  test "should generate host image" do
20
20
  ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk host template/))).yields("temp ISO")
21
21
  @controller.expects(:read_file).with("temp ISO").returns("ISO image")
22
- get :host, {:id => @host.name}
22
+ get :host, params: {:id => @host.name}
23
23
  assert_response :success
24
24
  assert_equal "ISO image", @response.body
25
25
  end
@@ -27,7 +27,7 @@ class ForemanBootdisk::Api::V2::DisksControllerTest < ActionController::TestCase
27
27
  test "should generate full host image" do
28
28
  ForemanBootdisk::ISOGenerator.expects(:generate_full_host).with(@host).yields("temp ISO")
29
29
  @controller.expects(:read_file).with("temp ISO").returns("ISO image")
30
- get :host, {:id => @host.name, :full => true}
30
+ get :host, params: {:id => @host.name, :full => true}
31
31
  assert_response :success
32
32
  assert_equal "ISO image", @response.body
33
33
  end
@@ -14,7 +14,7 @@ class ForemanBootdisk::Api::V2::SubnetDisksControllerTest < ActionController::Te
14
14
  ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk generic host template/))).yields("temp ISO")
15
15
  ForemanBootdisk::Renderer.any_instance.stubs(:bootdisk_chain_url).yields("http://smart-proxy.lan")
16
16
  File.expects(:read).with("temp ISO").returns("ISO image")
17
- get :subnet, {:id => @host.subnet.id}
17
+ get :subnet, params: {:id => @host.subnet.id}
18
18
  assert_response :success
19
19
  assert_equal "ISO image", @response.body
20
20
  end
@@ -7,7 +7,7 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
7
7
  test "should generate generic image" do
8
8
  ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk generic host template/))).yields("temp ISO")
9
9
  @controller.expects(:read_file).with("temp ISO").returns("ISO image")
10
- get :generic, {}, set_session_user
10
+ get :generic, session: set_session_user
11
11
  assert_response :success
12
12
  assert_equal "ISO image", @response.body
13
13
  end
@@ -21,7 +21,7 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
21
21
  test "should generate host image" do
22
22
  ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk host template/))).yields("temp ISO")
23
23
  @controller.expects(:read_file).with("temp ISO").returns("ISO image")
24
- get :host, {:id => @host.name}, set_session_user
24
+ get :host, params: {:id => @host.name}, session: set_session_user
25
25
  assert_response :success
26
26
  assert_equal "ISO image", @response.body
27
27
  end
@@ -29,7 +29,7 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
29
29
  test "should generate full host image" do
30
30
  ForemanBootdisk::ISOGenerator.expects(:generate_full_host).with(@host).yields("temp ISO")
31
31
  @controller.expects(:read_file).with("temp ISO").returns("ISO image")
32
- get :full_host, {:id => @host.name}, set_session_user
32
+ get :full_host, params: {:id => @host.name}, session: set_session_user
33
33
  assert_response :success
34
34
  assert_equal "ISO image", @response.body
35
35
  end
@@ -38,7 +38,7 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
38
38
  ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk generic host template/))).yields("temp ISO")
39
39
  ForemanBootdisk::Renderer.any_instance.stubs(:bootdisk_chain_url).yields("http://smart-proxy.lan")
40
40
  @controller.expects(:read_file).with("temp ISO").returns("ISO image")
41
- get :subnet, {:id => @host.name}, set_session_user
41
+ get :subnet, params: {:id => @host.name}, session: set_session_user
42
42
  assert_empty flash[:error]
43
43
  assert_response :success
44
44
  assert_equal "ISO image", @response.body
@@ -52,14 +52,14 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
52
52
  setup :setup_host
53
53
 
54
54
  test "should not generate subnet image" do
55
- get :subnet, {:id => @host.name}, set_session_user
55
+ get :subnet, params: {:id => @host.name}, session: set_session_user
56
56
  assert_match(/Failed.*: TFTP feature not enabled/, flash[:error])
57
57
  assert_response :redirect
58
58
  end
59
59
  end
60
60
 
61
61
  test "should render help" do
62
- get :help, {}, set_session_user
62
+ get :help, session: set_session_user
63
63
  assert_response :success
64
64
  end
65
65
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_bootdisk
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.0.2
4
+ version: 11.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: 2018-01-08 00:00:00.000000000 Z
11
+ date: 2018-01-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Plugin for Foreman that creates iPXE-based boot disks to provision hosts
14
14
  without the need for PXE infrastructure.