Skip to content

Commit

Permalink
Fixes #17468 - build PXE returns error with no TFTP proxies
Browse files Browse the repository at this point in the history
Build PXE menu responds with no error when no TFTP
proxies are found, it renders an error message in the UI.
  • Loading branch information
amirfefer authored and domcleal committed Nov 24, 2016
1 parent e18d69e commit af53af4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/provisioning_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def self.find_template(opts = {})
end

def self.build_pxe_default(renderer)
return [200, _("No TFTP proxies defined, can't continue")] if (proxies = SmartProxy.with_features("TFTP")).empty?
return [422, _("No TFTP proxies defined, can't continue")] if (proxies = SmartProxy.with_features("TFTP")).empty?

error_msgs = []
TemplateKind::PXE.each do |kind|
Expand Down
6 changes: 6 additions & 0 deletions test/controllers/provisioning_templates_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ class ProvisioningTemplatesControllerTest < ActionController::TestCase
assert_redirected_to provisioning_templates_path
end

test "build menu should return with error code if no TFTP defined" do
SmartProxy.stubs(:with_features).with('TFTP').returns([])
get :build_pxe_default, {}, set_session_user
assert flash[:error].present?
end

test "pxe menu's labels should be sorted" do
t1 = TemplateCombination.new :hostgroup => hostgroups(:db), :environment => environments(:production)
t1.provisioning_template = templates(:mystring2)
Expand Down

0 comments on commit af53af4

Please sign in to comment.