foreman_git_templates 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/concerns/foreman_git_templates/host_extensions.rb +14 -1
- data/app/models/concerns/foreman_git_templates/host_parameter_extensions.rb +19 -0
- data/app/models/concerns/foreman_git_templates/hostext/operating_system.rb +2 -2
- data/app/models/concerns/foreman_git_templates/orchestration/tftp.rb +16 -6
- data/app/models/setting/git_templates.rb +26 -0
- data/app/services/foreman_git_templates/repository_reader.rb +3 -2
- data/lib/foreman_git_templates/engine.rb +9 -0
- data/lib/foreman_git_templates/version.rb +1 -1
- data/test/controllers/hosts_controller_test.rb +1 -1
- data/test/controllers/unattended_controller_test.rb +5 -1
- data/test/factories/foreman_git_templates_factories.rb +3 -1
- data/test/models/concerns/foreman_git_templates/hostext/operating_system_test.rb +7 -3
- data/test/models/concerns/foreman_git_templates/orchestration/tftp_test.rb +18 -23
- data/test/models/foreman_git_templates/host_parameter_test.rb +57 -0
- data/test/models/foreman_git_templates/host_test.rb +73 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77802b4e97100b9c7e7cec4969831e66935359298e010a978f1086523ff499a3
|
4
|
+
data.tar.gz: 9061fb7d4caec9a6713272116028489bd23fb10240234d2a791acf718019788d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be061019f7d11d89d5f1cbb28b8b92c91e7866b9a4c3c3b2ea043c593be33d55038999c40bca88a01bfd7b26bc8ee664c1848955fac221efc999290a370a08d7
|
7
|
+
data.tar.gz: f9ee9ae528c9b6eb8892334aef83bedffda5067832b3b3e98cf9470343ba976fe47e2d7080c49e1d89709e425d9cdf218d9b26f700deb0125033889ab345305b
|
@@ -2,10 +2,20 @@
|
|
2
2
|
|
3
3
|
module ForemanGitTemplates
|
4
4
|
module HostExtensions
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
validates_associated :host_parameters
|
9
|
+
end
|
10
|
+
|
11
|
+
def repository_klass
|
12
|
+
build? ? MainRepositoryTemplate : DefaultLocalBootRepositoryTemplate
|
13
|
+
end
|
14
|
+
|
5
15
|
def repository_path
|
6
16
|
return unless git_template_url
|
7
17
|
|
8
|
-
git_template_tmpfile
|
18
|
+
git_template_tmpfile&.path
|
9
19
|
end
|
10
20
|
|
11
21
|
private
|
@@ -18,6 +28,9 @@ module ForemanGitTemplates
|
|
18
28
|
return unless git_template_url
|
19
29
|
|
20
30
|
@git_template_tmpfile ||= RepositoryFetcher.call(git_template_url)
|
31
|
+
rescue ::ForemanGitTemplates::RepositoryFetcher::RepositoryFetcherError => e
|
32
|
+
Foreman::Logging.exception("GitTemplates: Failed to fetch data from #{git_template_url}", e)
|
33
|
+
nil
|
21
34
|
end
|
22
35
|
end
|
23
36
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ForemanGitTemplates
|
4
|
+
module HostParameterExtensions
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
validate :template_url_is_reachable, if: ->(p) { p.name == 'template_url' }
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def template_url_is_reachable
|
14
|
+
RestClient::Request.execute(method: :head, url: value, timeout: Setting::GitTemplates['template_url_validation_timeout'])
|
15
|
+
rescue RestClient::ExceptionWithResponse, URI::InvalidURIError, SocketError => e
|
16
|
+
errors.add(:value, _('Cannot fetch templates from %{url}: %{error}') % { url: value, error: e.message })
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -17,8 +17,8 @@ module ForemanGitTemplates
|
|
17
17
|
return super unless repository_path
|
18
18
|
|
19
19
|
@available_template_kinds ||= template_kinds(provisioning).map do |kind|
|
20
|
-
|
21
|
-
RepositoryReader.call(repository_path,
|
20
|
+
repository_klass.new(name: kind.name).tap do |t|
|
21
|
+
t.template = RepositoryReader.call(repository_path, t.path)
|
22
22
|
end
|
23
23
|
rescue RepositoryReader::FileUnreadableError # file is missing or empty
|
24
24
|
next
|
@@ -9,16 +9,26 @@ module ForemanGitTemplates
|
|
9
9
|
delegate :render_template, to: :host
|
10
10
|
|
11
11
|
def generate_pxe_template(kind)
|
12
|
-
return super unless host.
|
12
|
+
return super unless host.params['template_url']
|
13
13
|
|
14
|
-
|
15
|
-
template = template_klass.new(name: kind)
|
14
|
+
template = host.repository_klass.new(name: kind)
|
16
15
|
render_template(template: template)
|
17
|
-
rescue ForemanGitTemplates::RepositoryReader::MissingFileError
|
18
|
-
# re-raise the exception if we have a main template defined for this type
|
19
|
-
raise e if host.available_template_kinds.map(&:name).include?(kind)
|
16
|
+
rescue ForemanGitTemplates::RepositoryReader::MissingFileError
|
20
17
|
nil
|
21
18
|
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def validate_tftp
|
23
|
+
return super unless host.params['template_url']
|
24
|
+
return unless tftp? || tftp6?
|
25
|
+
return unless host.operatingsystem
|
26
|
+
|
27
|
+
pxe_kind = host.operatingsystem.pxe_loader_kind(host)
|
28
|
+
return unless pxe_kind && host.provisioning_template(kind: pxe_kind).nil?
|
29
|
+
|
30
|
+
failure _('No %{kind} template was found for host %{host}. Repository url: %{url}') % { kind: pxe_kind, host: host.name, url: host.params['template_url'] }
|
31
|
+
end
|
22
32
|
end
|
23
33
|
|
24
34
|
included do
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Setting
|
4
|
+
class GitTemplates < ::Setting
|
5
|
+
def self.default_settings
|
6
|
+
[
|
7
|
+
set('template_url_validation_timeout', N_('Template URL validation timeout in seconds'), 15, N_('Template URL validation timeout'))
|
8
|
+
]
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.load_defaults
|
12
|
+
# Check the table exists
|
13
|
+
return unless super
|
14
|
+
|
15
|
+
transaction do
|
16
|
+
default_settings.each { |s| create! s.update(category: 'Setting::GitTemplates') }
|
17
|
+
end
|
18
|
+
|
19
|
+
true
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.humanized_category
|
23
|
+
N_('GitTemplates')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -35,8 +35,9 @@ module ForemanGitTemplates
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
|
-
rescue Errno::ENOENT
|
39
|
-
|
38
|
+
rescue Errno::ENOENT, Zlib::GzipFile::Error => e
|
39
|
+
Foreman::Logging.exception("GitTemplates: Cannot read repository from #{repository_path}", e)
|
40
|
+
raise RepositoryUnreadableError, _('Cannot read repository from %{repository_path}: %{error}') % { repository_path: repository_path, error: e.message }
|
40
41
|
end
|
41
42
|
end
|
42
43
|
end
|
@@ -8,6 +8,14 @@ module ForemanGitTemplates
|
|
8
8
|
config.autoload_paths += Dir["#{config.root}/app/services"]
|
9
9
|
config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
|
10
10
|
|
11
|
+
initializer 'foreman_git_templates.load_default_settings', before: :load_config_initializers do
|
12
|
+
require_dependency File.expand_path('../../app/models/setting/git_templates.rb', __dir__) if begin
|
13
|
+
Setting.table_exists?
|
14
|
+
rescue StandardError
|
15
|
+
(false)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
11
19
|
initializer 'foreman_git_templates.register_plugin', before: :finisher_hook do |_app|
|
12
20
|
Foreman::Plugin.register :foreman_git_templates do
|
13
21
|
requires_foreman '>= 1.20'
|
@@ -19,6 +27,7 @@ module ForemanGitTemplates
|
|
19
27
|
Foreman::Renderer.singleton_class.prepend(ForemanGitTemplates::Renderer)
|
20
28
|
Host::Managed.include(ForemanGitTemplates::Hostext::OperatingSystem)
|
21
29
|
Host::Managed.include(ForemanGitTemplates::HostExtensions)
|
30
|
+
HostParameter.include(ForemanGitTemplates::HostParameterExtensions)
|
22
31
|
Nic::Managed.include(ForemanGitTemplates::Orchestration::TFTP)
|
23
32
|
UnattendedController.include(ForemanGitTemplates::UnattendedControllerExtensions)
|
24
33
|
rescue StandardError => e
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'test_plugin_helper'
|
4
4
|
|
5
5
|
class HostsControllerTest < ActionController::TestCase
|
6
|
-
let(:host) { FactoryBot.create(:host, :managed, :with_template_url) }
|
6
|
+
let(:host) { FactoryBot.create(:host, :managed, :with_template_url, build: true) }
|
7
7
|
|
8
8
|
describe '#templates' do
|
9
9
|
it 'returns only templates that are defined in the archive' do
|
@@ -5,7 +5,7 @@ require 'test_plugin_helper'
|
|
5
5
|
class UnattendedControllerTest < ActionController::TestCase
|
6
6
|
let(:os) { FactoryBot.create(:operatingsystem, :with_associations, type: 'Redhat') }
|
7
7
|
let(:host) do
|
8
|
-
FactoryBot.create(:host, :managed, :with_template_url, operatingsystem: os, ptable: os.ptables.first)
|
8
|
+
FactoryBot.create(:host, :managed, :with_template_url, build: true, operatingsystem: os, ptable: os.ptables.first)
|
9
9
|
end
|
10
10
|
|
11
11
|
test 'should render template from repository' do
|
@@ -70,6 +70,10 @@ class UnattendedControllerTest < ActionController::TestCase
|
|
70
70
|
end
|
71
71
|
|
72
72
|
describe 'iPXE templates' do
|
73
|
+
let(:host) do
|
74
|
+
FactoryBot.create(:host, :managed, :with_template_url, build: false, operatingsystem: os, ptable: os.ptables.first)
|
75
|
+
end
|
76
|
+
|
73
77
|
context 'host not in build mode' do
|
74
78
|
test 'should render iPXE local boot template from repository' do
|
75
79
|
assert_not_nil host.params['template_url']
|
@@ -4,7 +4,9 @@ FactoryBot.modify do
|
|
4
4
|
factory :host do
|
5
5
|
trait :with_template_url do
|
6
6
|
after(:create) do |host, _evaluator|
|
7
|
-
|
7
|
+
url = 'http://www.api.com/repository.tar.gz'
|
8
|
+
WebMock::API.stub_request(:head, url).to_return(status: 200)
|
9
|
+
FactoryBot.create(:host_parameter, host: host, name: 'template_url', value: url)
|
8
10
|
end
|
9
11
|
end
|
10
12
|
end
|
@@ -4,7 +4,7 @@ require 'test_plugin_helper'
|
|
4
4
|
|
5
5
|
module Hostext
|
6
6
|
class OperatingSystemTest < ActiveSupport::TestCase
|
7
|
-
let(:host) { FactoryBot.create(:host, :managed, :with_template_url) }
|
7
|
+
let(:host) { FactoryBot.create(:host, :managed, :with_template_url, build: true) }
|
8
8
|
|
9
9
|
describe '#provisioning_template' do
|
10
10
|
it 'finds all PXELinux template kinds' do
|
@@ -13,7 +13,9 @@ module Hostext
|
|
13
13
|
tar.add_file_simple('templates/PXELinux/template.erb', 644, host.name.length) { |io| io.write(host.name) }
|
14
14
|
end
|
15
15
|
|
16
|
-
|
16
|
+
actual = host.provisioning_template(kind: 'PXELinux')
|
17
|
+
assert_equal 'PXELinux', actual.name
|
18
|
+
assert_equal host.name, actual.template
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
@@ -23,7 +25,9 @@ module Hostext
|
|
23
25
|
tar.add_file_simple('templates/PXELinux/template.erb', 644, host.name.length) { |io| io.write(host.name) }
|
24
26
|
end
|
25
27
|
|
26
|
-
|
28
|
+
actual = host.provisioning_template(kind: :PXELinux)
|
29
|
+
assert_equal 'PXELinux', actual.name
|
30
|
+
assert_equal host.name, actual.template
|
27
31
|
end
|
28
32
|
end
|
29
33
|
end
|
@@ -15,47 +15,42 @@ class TFTPOrchestrationTest < ActiveSupport::TestCase
|
|
15
15
|
Dir.mktmpdir do |dir|
|
16
16
|
stub_repository host.params['template_url'], "#{dir}/repo.tar.gz" do |tar|
|
17
17
|
tar.add_file_simple("templates/#{kind}/template.erb", 644, template_content.length) { |io| io.write(template_content) }
|
18
|
-
tar.add_file_simple("templates/#{kind}/default_local_boot.erb", 644, default_local_boot_template_content.length) { |io| io.write(default_local_boot_template_content) }
|
19
18
|
end
|
20
19
|
|
21
|
-
assert_equal template_content, host.generate_pxe_template(
|
20
|
+
assert_equal template_content, host.generate_pxe_template(kind)
|
22
21
|
end
|
23
22
|
end
|
24
|
-
end
|
25
23
|
|
26
|
-
|
27
|
-
|
24
|
+
context 'when corresponding default local boot template file is missing in the repo' do
|
25
|
+
it 'does not generate a pxe template' do
|
26
|
+
Dir.mktmpdir do |dir|
|
27
|
+
stub_repository host.params['template_url'], "#{dir}/repo.tar.gz"
|
28
28
|
|
29
|
-
|
30
|
-
Dir.mktmpdir do |dir|
|
31
|
-
stub_repository host.params['template_url'], "#{dir}/repo.tar.gz" do |tar|
|
32
|
-
tar.add_file_simple("templates/#{kind}/template.erb", 644, template_content.length) { |io| io.write(template_content) }
|
33
|
-
tar.add_file_simple("templates/#{kind}/default_local_boot.erb", 644, default_local_boot_template_content.length) { |io| io.write(default_local_boot_template_content) }
|
29
|
+
assert_nil host.generate_pxe_template(kind)
|
34
30
|
end
|
35
|
-
|
36
|
-
assert_equal default_local_boot_template_content, host.generate_pxe_template('PXELinux')
|
37
31
|
end
|
38
32
|
end
|
33
|
+
end
|
39
34
|
|
40
|
-
|
35
|
+
context 'host is not in build mode' do
|
36
|
+
let(:host) { FactoryBot.create(:host, :managed, :with_template_url, build: false) }
|
37
|
+
|
38
|
+
it 'renders default local boot template' do
|
41
39
|
Dir.mktmpdir do |dir|
|
42
40
|
stub_repository host.params['template_url'], "#{dir}/repo.tar.gz" do |tar|
|
43
|
-
tar.add_file_simple("templates/#{kind}/template.erb", 644, template_content.length) { |io| io.write(template_content) }
|
44
41
|
tar.add_file_simple("templates/#{kind}/default_local_boot.erb", 644, default_local_boot_template_content.length) { |io| io.write(default_local_boot_template_content) }
|
45
42
|
end
|
46
43
|
|
47
|
-
|
44
|
+
assert_equal default_local_boot_template_content, host.generate_pxe_template(kind)
|
48
45
|
end
|
49
46
|
end
|
50
47
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
48
|
+
context 'when corresponding default local boot template file is missing in the repo' do
|
49
|
+
it 'does not generate a pxe template' do
|
50
|
+
Dir.mktmpdir do |dir|
|
51
|
+
stub_repository host.params['template_url'], "#{dir}/repo.tar.gz"
|
56
52
|
|
57
|
-
|
58
|
-
host.generate_pxe_template('PXELinux')
|
53
|
+
assert_nil host.generate_pxe_template(kind)
|
59
54
|
end
|
60
55
|
end
|
61
56
|
end
|
@@ -63,7 +58,7 @@ class TFTPOrchestrationTest < ActiveSupport::TestCase
|
|
63
58
|
end
|
64
59
|
|
65
60
|
describe '#validate_tftp' do
|
66
|
-
let(:host) { FactoryBot.create(:host, :with_tftp_orchestration, :with_template_url, pxe_loader: 'PXELinux BIOS') }
|
61
|
+
let(:host) { FactoryBot.create(:host, :with_tftp_orchestration, :with_template_url, build: false, pxe_loader: 'PXELinux BIOS') }
|
67
62
|
let(:kind) { 'PXELinux' }
|
68
63
|
let(:template_content) { 'main template content' }
|
69
64
|
let(:default_local_boot_template_content) { 'default local boot template content' }
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_plugin_helper'
|
4
|
+
|
5
|
+
module ForemanGitTemplates
|
6
|
+
class HostParameterTest < ActiveSupport::TestCase
|
7
|
+
describe 'template_url validation' do
|
8
|
+
let(:template_url) { 'http://api.com/repo.tar.gz' }
|
9
|
+
let(:host) { FactoryBot.create(:host) }
|
10
|
+
let(:host_parameter) { FactoryBot.build(:host_parameter, name: 'template_url', value: template_url, host: host) }
|
11
|
+
|
12
|
+
context 'when template_url returns 200' do
|
13
|
+
it 'is valid' do
|
14
|
+
stub_request(:head, template_url).to_return(status: 200)
|
15
|
+
|
16
|
+
assert host_parameter.valid?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when template_url returns 401' do
|
21
|
+
it 'is invlid' do
|
22
|
+
stub_request(:head, template_url).to_return(status: 401)
|
23
|
+
|
24
|
+
assert_equal false, host_parameter.valid?
|
25
|
+
assert_not_empty host_parameter.errors[:value]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when template_url returns 404' do
|
30
|
+
it 'is invlid' do
|
31
|
+
stub_request(:head, template_url).to_return(status: 404)
|
32
|
+
|
33
|
+
assert_equal false, host_parameter.valid?
|
34
|
+
assert_not_empty host_parameter.errors[:value]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'when template_url returns 500' do
|
39
|
+
it 'is invlid' do
|
40
|
+
stub_request(:head, template_url).to_return(status: 500)
|
41
|
+
|
42
|
+
assert_equal false, host_parameter.valid?
|
43
|
+
assert_not_empty host_parameter.errors[:value]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'when template_url is not a valid URL' do
|
48
|
+
let(:template_url) { 'not URL value' }
|
49
|
+
|
50
|
+
it 'is invlid' do
|
51
|
+
assert_equal false, host_parameter.valid?
|
52
|
+
assert_not_empty host_parameter.errors[:value]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -25,5 +25,78 @@ module ForemanGitTemplates
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
describe '#update' do
|
30
|
+
let(:os) { FactoryBot.create(:operatingsystem, :with_associations, type: 'Redhat') }
|
31
|
+
|
32
|
+
setup do
|
33
|
+
host.expects(:skip_orchestration_for_testing?).at_least_once.returns(false)
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'with valid template_url' do
|
37
|
+
context 'when host is in build mode' do
|
38
|
+
let(:host) { FactoryBot.create(:host, :with_tftp_orchestration, :with_template_url, operatingsystem: os, build: true) }
|
39
|
+
|
40
|
+
it 'updates the host' do
|
41
|
+
ProxyAPI::Resource.any_instance.stubs(:post).returns(true)
|
42
|
+
ProxyAPI::TFTP.any_instance.stubs(:fetch_boot_file).returns(true)
|
43
|
+
|
44
|
+
Dir.mktmpdir do |dir|
|
45
|
+
stub_repository host.params['template_url'], "#{dir}/repo.tar.gz" do |tar|
|
46
|
+
tar.add_file_simple('templates/PXEGrub2/template.erb', 644, host.name.length) { |io| io.write(host.name) }
|
47
|
+
end
|
48
|
+
|
49
|
+
assert host.update(name: 'newname')
|
50
|
+
assert_empty host.errors.messages
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'when host is not in build mode' do
|
56
|
+
let(:host) { FactoryBot.create(:host, :with_tftp_orchestration, :with_template_url, operatingsystem: os, build: false) }
|
57
|
+
|
58
|
+
it 'updates the host' do
|
59
|
+
ProxyAPI::TFTP.any_instance.stubs(:set).returns(true)
|
60
|
+
|
61
|
+
Dir.mktmpdir do |dir|
|
62
|
+
stub_repository host.params['template_url'], "#{dir}/repo.tar.gz" do |tar|
|
63
|
+
tar.add_file_simple('templates/PXEGrub2/default_local_boot.erb', 644, host.name.length) { |io| io.write(host.name) }
|
64
|
+
end
|
65
|
+
|
66
|
+
assert host.update(name: 'newname')
|
67
|
+
assert_empty host.errors.messages
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'with invalid template_url' do
|
74
|
+
setup do
|
75
|
+
stub_request(:get, host.params['template_url']).to_return(status: 404)
|
76
|
+
end
|
77
|
+
|
78
|
+
let(:expected_errors) { ["No PXEGrub2 template was found for host #{host.name}. Repository url: #{host.params['template_url']}"] }
|
79
|
+
|
80
|
+
context 'when host is in build mode' do
|
81
|
+
let(:host) { FactoryBot.create(:host, :with_tftp_orchestration, :with_template_url, operatingsystem: os, build: true) }
|
82
|
+
|
83
|
+
it 'does not update the host' do
|
84
|
+
assert_equal false, host.update(name: 'newname')
|
85
|
+
assert_equal expected_errors, host.errors[:base]
|
86
|
+
assert_equal expected_errors, host.errors[:'interfaces.base']
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
context 'when host is not in build mode' do
|
91
|
+
let(:host) { FactoryBot.create(:host, :with_tftp_orchestration, :with_template_url, operatingsystem: os, build: false) }
|
92
|
+
|
93
|
+
it 'does not update the host' do
|
94
|
+
assert_equal false, host.update(name: 'newname')
|
95
|
+
assert_equal expected_errors, host.errors[:base]
|
96
|
+
assert_equal expected_errors, host.errors[:'interfaces.base']
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
28
101
|
end
|
29
102
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_git_templates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dmTECH GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: down
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.1'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rdoc
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,12 +81,14 @@ files:
|
|
67
81
|
- app/lib/foreman_git_templates/renderer/source/repository.rb
|
68
82
|
- app/lib/foreman_git_templates/tar.rb
|
69
83
|
- app/models/concerns/foreman_git_templates/host_extensions.rb
|
84
|
+
- app/models/concerns/foreman_git_templates/host_parameter_extensions.rb
|
70
85
|
- app/models/concerns/foreman_git_templates/hostext/operating_system.rb
|
71
86
|
- app/models/concerns/foreman_git_templates/orchestration/tftp.rb
|
72
87
|
- app/models/foreman_git_templates/base_repository_template.rb
|
73
88
|
- app/models/foreman_git_templates/default_local_boot_repository_template.rb
|
74
89
|
- app/models/foreman_git_templates/main_repository_template.rb
|
75
90
|
- app/models/foreman_git_templates/snippet_repository_template.rb
|
91
|
+
- app/models/setting/git_templates.rb
|
76
92
|
- app/services/foreman_git_templates/repository_fetcher.rb
|
77
93
|
- app/services/foreman_git_templates/repository_reader.rb
|
78
94
|
- config/routes.rb
|
@@ -85,6 +101,7 @@ files:
|
|
85
101
|
- test/factories/foreman_git_templates_factories.rb
|
86
102
|
- test/models/concerns/foreman_git_templates/hostext/operating_system_test.rb
|
87
103
|
- test/models/concerns/foreman_git_templates/orchestration/tftp_test.rb
|
104
|
+
- test/models/foreman_git_templates/host_parameter_test.rb
|
88
105
|
- test/models/foreman_git_templates/host_test.rb
|
89
106
|
- test/models/foreman_git_templates/snippet_repository_template_test.rb
|
90
107
|
- test/test_plugin_helper.rb
|
@@ -121,6 +138,7 @@ test_files:
|
|
121
138
|
- test/unit/repository_reader_test.rb
|
122
139
|
- test/models/foreman_git_templates/snippet_repository_template_test.rb
|
123
140
|
- test/models/foreman_git_templates/host_test.rb
|
141
|
+
- test/models/foreman_git_templates/host_parameter_test.rb
|
124
142
|
- test/models/concerns/foreman_git_templates/hostext/operating_system_test.rb
|
125
143
|
- test/models/concerns/foreman_git_templates/orchestration/tftp_test.rb
|
126
144
|
- test/factories/foreman_git_templates_factories.rb
|