foreman_bootdisk 6.0.0 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +5 -0
  3. data/README.md +46 -2
  4. data/app/controllers/foreman_bootdisk/api/v2/subnet_disks_controller.rb +37 -0
  5. data/app/controllers/foreman_bootdisk/disks_controller.rb +26 -3
  6. data/app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb +12 -0
  7. data/app/models/concerns/foreman_bootdisk/host_ext.rb +1 -4
  8. data/app/services/foreman_bootdisk/iso_generator.rb +4 -4
  9. data/app/services/foreman_bootdisk/renderer.rb +25 -6
  10. data/app/views/foreman_bootdisk/disks/help.html.erb +9 -1
  11. data/app/views/foreman_bootdisk/generic_host.erb +2 -1
  12. data/config/routes.rb +2 -0
  13. data/db/migrate/20140522185700_change_templatekind_to_bootdisk.rb +1 -1
  14. data/db/seeds.d/50-bootdisk_templates.rb +17 -15
  15. data/lib/foreman_bootdisk.rb +1 -2
  16. data/lib/foreman_bootdisk/engine.rb +8 -2
  17. data/lib/foreman_bootdisk/version.rb +1 -1
  18. data/lib/tasks/bootdisk.rake +12 -0
  19. data/locale/ca/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  20. data/locale/ca/foreman_bootdisk.po +167 -0
  21. data/locale/de/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  22. data/locale/de/foreman_bootdisk.po +18 -17
  23. data/locale/en/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  24. data/locale/en/foreman_bootdisk.po +85 -39
  25. data/locale/en_GB/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  26. data/locale/en_GB/foreman_bootdisk.po +26 -25
  27. data/locale/es/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  28. data/locale/es/foreman_bootdisk.po +6 -5
  29. data/locale/foreman_bootdisk.pot +145 -44
  30. data/locale/fr/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  31. data/locale/fr/foreman_bootdisk.po +10 -10
  32. data/locale/it/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  33. data/locale/it/foreman_bootdisk.po +3 -3
  34. data/locale/ja/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  35. data/locale/ja/foreman_bootdisk.po +14 -13
  36. data/locale/ko/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  37. data/locale/ko/foreman_bootdisk.po +3 -3
  38. data/locale/pt_BR/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  39. data/locale/pt_BR/foreman_bootdisk.po +8 -7
  40. data/locale/ru/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  41. data/locale/ru/foreman_bootdisk.po +28 -27
  42. data/locale/sv_SE/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  43. data/locale/sv_SE/foreman_bootdisk.po +3 -3
  44. data/locale/zh_CN/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  45. data/locale/zh_CN/foreman_bootdisk.po +3 -3
  46. data/locale/zh_TW/LC_MESSAGES/foreman_bootdisk.mo +0 -0
  47. data/locale/zh_TW/foreman_bootdisk.po +3 -3
  48. data/test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb +4 -2
  49. data/test/functional/foreman_bootdisk/api/v2/subnet_disks_controller_test.rb +20 -0
  50. data/test/functional/foreman_bootdisk/disks_controller_test.rb +26 -2
  51. data/test/test_plugin_helper.rb +16 -4
  52. metadata +6 -2
@@ -5,12 +5,12 @@
5
5
  # Translators:
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_bootdisk 4.0.2\n"
8
+ "Project-Id-Version: foreman_bootdisk 6.0.0\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "POT-Creation-Date: 2015-02-20 11:19+0000\n"
11
11
  "PO-Revision-Date: 2015-02-20 11:24+0000\n"
12
- "Last-Translator: Dominic Cleal <dcleal@redhat.com>\n"
13
- "Language-Team: Chinese (Taiwan) (http://www.transifex.com/projects/p/foreman/language/zh_TW/)\n"
12
+ "Last-Translator: Dominic Cleal <dominic@cleal.org>\n"
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"
@@ -4,7 +4,7 @@ class ForemanBootdisk::Api::V2::DisksControllerTest < ActionController::TestCase
4
4
  setup :setup_bootdisk
5
5
 
6
6
  test "should generate generic image" do
7
- ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/generic host template/))).yields("temp ISO")
7
+ ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk generic host template/))).yields("temp ISO")
8
8
  File.expects(:read).with("temp ISO").returns("ISO image")
9
9
  get :generic, {}
10
10
  assert_response :success
@@ -12,10 +12,12 @@ class ForemanBootdisk::Api::V2::DisksControllerTest < ActionController::TestCase
12
12
  end
13
13
 
14
14
  describe "#host" do
15
+ setup :setup_org_loc
16
+ setup :setup_subnet
15
17
  setup :setup_host
16
18
 
17
19
  test "should generate host image" do
18
- ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/host template/))).yields("temp ISO")
20
+ ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk host template/))).yields("temp ISO")
19
21
  File.expects(:read).with("temp ISO").returns("ISO image")
20
22
  get :host, {:id => @host.name}
21
23
  assert_response :success
@@ -0,0 +1,20 @@
1
+ require 'test_plugin_helper'
2
+
3
+ class ForemanBootdisk::Api::V2::SubnetDisksControllerTest < ActionController::TestCase
4
+ setup :setup_bootdisk
5
+
6
+ describe "#subnet_host" do
7
+ setup :setup_org_loc
8
+ setup :setup_subnet
9
+ setup :setup_host
10
+
11
+ test "should generate subnet generic host image" do
12
+ ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk generic host template/))).yields("temp ISO")
13
+ ForemanBootdisk::Renderer.any_instance.stubs(:bootdisk_chain_url).yields("http://smart-proxy.lan")
14
+ File.expects(:read).with("temp ISO").returns("ISO image")
15
+ get :subnet, {:id => @host.subnet.id}
16
+ assert_response :success
17
+ assert_equal "ISO image", @response.body
18
+ end
19
+ end
20
+ end
@@ -4,7 +4,7 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
4
4
  setup :setup_bootdisk
5
5
 
6
6
  test "should generate generic image" do
7
- ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/generic host template/))).yields("temp ISO")
7
+ ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk generic host template/))).yields("temp ISO")
8
8
  File.expects(:read).with("temp ISO").returns("ISO image")
9
9
  get :generic, {}, set_session_user
10
10
  assert_response :success
@@ -12,10 +12,12 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
12
12
  end
13
13
 
14
14
  describe "#host" do
15
+ setup :setup_org_loc
16
+ setup :setup_subnet
15
17
  setup :setup_host
16
18
 
17
19
  test "should generate host image" do
18
- ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/host template/))).yields("temp ISO")
20
+ ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk host template/))).yields("temp ISO")
19
21
  File.expects(:read).with("temp ISO").returns("ISO image")
20
22
  get :host, {:id => @host.name}, set_session_user
21
23
  assert_response :success
@@ -29,6 +31,28 @@ class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
29
31
  assert_response :success
30
32
  assert_equal "ISO image", @response.body
31
33
  end
34
+
35
+ test "should generate subnet image" do
36
+ ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk generic host template/))).yields("temp ISO")
37
+ ForemanBootdisk::Renderer.any_instance.stubs(:bootdisk_chain_url).yields("http://smart-proxy.lan")
38
+ File.expects(:read).with("temp ISO").returns("ISO image")
39
+ get :subnet, {:id => @host.name}, set_session_user
40
+ assert_empty flash[:error]
41
+ assert_response :success
42
+ assert_equal "ISO image", @response.body
43
+ end
44
+ end
45
+
46
+ describe "#host without tftp" do
47
+ setup :setup_org_loc
48
+ setup :setup_subnet_no_tftp
49
+ setup :setup_host
50
+
51
+ test "should not generate subnet image" do
52
+ get :subnet, {:id => @host.name}, set_session_user
53
+ assert_match(/Failed.*: TFTP feature not enabled/, flash[:error])
54
+ assert_response :redirect
55
+ end
32
56
  end
33
57
 
34
58
  test "should render help" do
@@ -19,10 +19,22 @@ class ActionController::TestCase
19
19
  load File.join(File.dirname(__FILE__), '..', 'db', 'seeds.d', '50-bootdisk_templates.rb')
20
20
  end
21
21
 
22
- def setup_host
22
+ def setup_org_loc
23
23
  disable_orchestration
24
- org, loc = FactoryGirl.create(:organization), FactoryGirl.create(:location)
25
- subnet = FactoryGirl.create(:subnet, :gateway => '10.0.1.254', :dns_primary => '8.8.8.8', :organizations => [org], :locations => [loc])
26
- @host = FactoryGirl.create(:host, :managed, :subnet => subnet, :ip => subnet.network.sub(/0$/, '4'), :organization => org, :location => loc)
24
+ request.env["HTTP_REFERER"] = "/history"
25
+ @org, @loc = FactoryGirl.create(:organization), FactoryGirl.create(:location)
26
+ end
27
+
28
+ def setup_subnet
29
+ @subnet = FactoryGirl.create(:subnet, :tftp, :gateway => '10.0.1.254', :dns_primary => '8.8.8.8', :organizations => [@org], :locations => [@loc])
30
+ end
31
+
32
+ def setup_subnet_no_tftp
33
+ @subnet = FactoryGirl.create(:subnet, :gateway => '10.0.1.254', :dns_primary => '8.8.8.8', :organizations => [@org], :locations => [@loc])
27
34
  end
35
+
36
+ def setup_host
37
+ @host = FactoryGirl.create(:host, :managed, :subnet => @subnet, :ip => @subnet.network.sub(/0$/, '4'), :organization => @org, :location => @loc)
38
+ end
39
+
28
40
  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: 6.0.0
4
+ version: 6.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: 2015-06-15 00:00:00.000000000 Z
11
+ date: 2016-01-21 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.
@@ -26,6 +26,7 @@ files:
26
26
  - README.md
27
27
  - app/controllers/concerns/foreman_bootdisk/unattended_controller_ext.rb
28
28
  - app/controllers/foreman_bootdisk/api/v2/disks_controller.rb
29
+ - app/controllers/foreman_bootdisk/api/v2/subnet_disks_controller.rb
29
30
  - app/controllers/foreman_bootdisk/disks_controller.rb
30
31
  - app/helpers/concerns/foreman_bootdisk/hosts_helper_ext.rb
31
32
  - app/models/concerns/foreman_bootdisk/host_ext.rb
@@ -49,6 +50,8 @@ files:
49
50
  - lib/foreman_bootdisk/version.rb
50
51
  - lib/tasks/bootdisk.rake
51
52
  - locale/Makefile
53
+ - locale/ca/LC_MESSAGES/foreman_bootdisk.mo
54
+ - locale/ca/foreman_bootdisk.po
52
55
  - locale/de/LC_MESSAGES/foreman_bootdisk.mo
53
56
  - locale/de/foreman_bootdisk.po
54
57
  - locale/en/LC_MESSAGES/foreman_bootdisk.mo
@@ -79,6 +82,7 @@ files:
79
82
  - locale/zh_TW/LC_MESSAGES/foreman_bootdisk.mo
80
83
  - locale/zh_TW/foreman_bootdisk.po
81
84
  - test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb
85
+ - test/functional/foreman_bootdisk/api/v2/subnet_disks_controller_test.rb
82
86
  - test/functional/foreman_bootdisk/disks_controller_test.rb
83
87
  - test/test_plugin_helper.rb
84
88
  homepage: http://github.com/theforeman/foreman_bootdisk