Skip to content
Snippets Groups Projects
Verified Commit 247b416b authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Update foreman_wds for 2.0 compatibility

parent 50646613
No related branches found
No related tags found
No related merge requests found
...@@ -31,20 +31,30 @@ os_selected = function(element){ ...@@ -31,20 +31,30 @@ os_selected = function(element){
} }
}; };
var old_onHostEditLoad = onHostEditLoad;
onHostEditLoad = function() {
old_onHostEditLoad();
$('#wds_provisioning').detach().insertBefore('#media_select');
};
function wds_provision_method_selected() { function wds_provision_method_selected() {
build_provision_method_selected(); $('div[id*=_provisioning]').hide();
$('#network_provisioning').show();
$('#wds_provisioning').show(); $('#wds_provisioning').show();
if ($('#wds_image_select select').val() === '') if ($('#wds_image_select select').val() === '') {
$('#wds_image_select select').attr('disabled', true); $('#wds_image_select select').attr('disabled', true);
}
} }
$(document).on('change', '#host_provision_method_wds', wds_provision_method_selected); $(document).on('change', '#host_provision_method_wds', wds_provision_method_selected);
$(function() { $(function() {
if($('#host_provision_method_wds').is(':checked')) {
wds_provision_method_selected();
}
var caps = $('#capabilities').val() || $('#bare_metal_capabilities').val(); var caps = $('#capabilities').val() || $('#bare_metal_capabilities').val();
update_capabilities(caps); update_capabilities(caps);
$('#provisioning_method input[checked]').click();
$('#wds_provisioning').detach().insertBefore('#media_select');
}); });
...@@ -40,23 +40,25 @@ module ForemanWds ...@@ -40,23 +40,25 @@ module ForemanWds
end end
def capabilities def capabilities
return [:wds] if wds_build?
return super + [:wds] if compute_resource && (os.nil? || os.family == 'Windows') return super + [:wds] if compute_resource && (os.nil? || os.family == 'Windows')
super super
end end
def bare_metal_capabilities def bare_metal_capabilities
return [:wds] if wds_build?
return super + [:wds] if os.nil? || os.family == 'Windows' return super + [:wds] if os.nil? || os.family == 'Windows'
super super
end end
def can_be_built? def can_be_built?
super || (wds? && !build?) super || (managed? && SETTINGS[:unattended] && wds? && !build?)
end end
def wds_build? def wds_build?
provision_method == 'wds' self[:provision_method] == 'wds'
end end
def pxe_build? def pxe_build?
...@@ -117,5 +119,5 @@ module ForemanWds ...@@ -117,5 +119,5 @@ module ForemanWds
end end
class ::Host::Managed::Jail < Safemode::Jail class ::Host::Managed::Jail < Safemode::Jail
allow :unattend_arch, :unattend_pass, :wds_facet, :wds_server, :wds_install_image_file, :wds_install_image_group, :wds_install_image_name allow :unattend_arch, :unattend_pass, :wds_build?, :wds_facet, :wds_server, :wds_install_image_file, :wds_install_image_group, :wds_install_image_name
end end
<%= javascript 'host_edit_extensions' %> <%= javascript 'foreman_wds/host_edit_extensions' %>
<% wds_facet = @host.wds_facet || @host.build_wds_facet -%> <% wds_facet = @host.wds_facet || @host.build_wds_facet -%>
<div id="wds_provisioning" <%= display? !@host.wds_build? %>> <div id="wds_provisioning" <%= display? !@host.wds_build? %>>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment