From d4d047f0a9d1c997e480378b78d837aca27ec52b Mon Sep 17 00:00:00 2001
From: Alexander Olofsson <alexander.olofsson@liu.se>
Date: Tue, 26 Oct 2021 11:52:11 +0200
Subject: [PATCH] Always filter out disabled images

---
 app/views/wds_servers/_image_select.html.erb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/views/wds_servers/_image_select.html.erb b/app/views/wds_servers/_image_select.html.erb
index e06089b..98f2922 100644
--- a/app/views/wds_servers/_image_select.html.erb
+++ b/app/views/wds_servers/_image_select.html.erb
@@ -2,8 +2,8 @@
   <%-
     host = @host || f.object.host
     server = host.public_send(:wds_server) rescue nil
-    images = server.all_images rescue []
-    images = images.select { |img| img.matches_architecture?(host.architecture) && img.enabled } if host.architecture
+    images = (server.all_images rescue []).select(&:enabled)
+    images = images.select { |img| img.matches_architecture?(host.architecture) } if host.architecture
     boot_images = images.select { |img| img.is_a?(ForemanWds::WdsBootImage) }
     install_images = images.select { |img| img.is_a?(ForemanWds::WdsInstallImage) }
 
-- 
GitLab