Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ITI/foreman_wds
1 result
Show changes
Commits on Source (3)
...@@ -32,29 +32,32 @@ function wds_os_selected() { ...@@ -32,29 +32,32 @@ function wds_os_selected() {
} }
}; };
function wds_content_loaded() {
$('#wds_provisioning').detach().insertBefore('#media_select');
$('#host_provision_method_build').prop('disabled', false);
$('#host_provision_method_wds').prop('disabled', false);
};
function wds_provision_method_selected() { function wds_provision_method_selected() {
$('div[id*=_provisioning]').hide(); $('div[id*=_provisioning]').hide();
$('#network_provisioning').show(); $('#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').prop('disabled', true);
} }
} }
$(document)
.on('change', '#host_provision_method_wds', wds_provision_method_selected)
.on('change', '.host-architecture-os-select', wds_os_selected)
.on('ContentLoad', wds_content_loaded);
$(function() { function wds_enable_provision_methods() {
$('#provision_method').show();
$('#host_provision_method_build').prop('disabled', false);
$('#host_provision_method_wds').prop('disabled', false);
if($('#host_provision_method_wds').is(':checked')) { if($('#host_provision_method_wds').is(':checked')) {
wds_provision_method_selected(); wds_provision_method_selected();
} }
};
$(document)
.on('change', '#host_provision_method_wds', wds_provision_method_selected)
.on('change', '.host-architecture-os-select', wds_os_selected);
$(function() {
$('#wds_provisioning').detach().insertBefore('#media_select');
wds_enable_provision_methods();
}); });
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
module ForemanWds module ForemanWds
module HostsControllerExtensions module HostsControllerExtensions
extend ActiveSupport::Concern
included do included do
before_action :cleanup_wds_params before_action :cleanup_wds_params
...@@ -17,8 +19,10 @@ module ForemanWds ...@@ -17,8 +19,10 @@ module ForemanWds
end end
def cleanup_wds_params def cleanup_wds_params
# Don't create a WDS facet unless provisioning with it return unless params.dig(:host, :provision_method)
params[:host].delete :wds_facet_attributes if params[:host] && params[:host][:provision_method] != 'wds'
# Don't create a WDS facet if not provisioning with it
params[:host].delete :wds_facet_attributes if params.dig(:host, :provision_method) != 'wds'
end end
end end
end end
...@@ -83,9 +83,13 @@ module ForemanWds ...@@ -83,9 +83,13 @@ module ForemanWds
HostsController.include ForemanWds::HostsControllerExtensions HostsController.include ForemanWds::HostsControllerExtensions
UnattendedController.prepend ForemanWds::UnattendedControllerExtensions UnattendedController.prepend ForemanWds::UnattendedControllerExtensions
ComputeResource.providers.each do |_k, const| ComputeResource.providers.each_value do |const|
Kernel.const_get(const).send(:prepend, ForemanWds::ComputeResourceExtensions) Kernel.const_get(const).send(:prepend, ForemanWds::ComputeResourceExtensions)
end end
if Foreman::Plugin.installed?('foreman_discovery')
DiscoveredHostsController.include ForemanWds::HostsControllerExtensions
end
rescue StandardError => e rescue StandardError => e
Rails.logger.fatal "foreman_wds: skipping engine hook (#{e})" Rails.logger.fatal "foreman_wds: skipping engine hook (#{e})"
end end
......