Project

General

Profile

« Previous | Next » 

Revision 51e8d9d2

Added by Greg Sutcliffe over 10 years ago

Fixes #4020 - enable @static to work on all OS template types

View differences:

app/controllers/unattended_controller.rb
def load_template_vars
# load the os family default variables
send "#{@host.os.pxe_type}_attributes"
# force static network configuration if static http parameter is defined, in the future this needs to go into the GUI
@static = !params[:static].empty?
end
def jumpstart_attributes
......
@osver = os.major.to_i
@mediapath = os.mediumpath @host
@repos = os.repos @host
# force static network configuration if static http parameter is defined, in the future this needs to go into the GUI
@static = !params[:static].empty?
end
def preseed_attributes
test/fixtures/config_templates.yml
mystring2:
name: MyString2
template: provision script <%%= foreman_url("finish") %>
template: provision script <%%= foreman_url("finish") %> static:<%%= @static.inspect %>
template_kind: provision
operatingsystems: centos5_3, redhat, ubuntu1010
test/functional/unattended_controller_test.rb
assert @response.headers["Content-Type"].match("text/plain")
end
test "should set @static when requested" do
Setting[:safemode_render]=false
@request.env["HTTP_X_RHN_PROVISIONING_MAC_0"] = "eth0 #{hosts(:redhat).mac}"
get(:provision, 'static' => 'true')
assert_match(%r{static:true}, @response.body)
end
test "should support spoof" do
get :provision, {:spoof => hosts(:ubuntu).ip}, set_session_user
assert_response :success

Also available in: Unified diff