--- Begin Message ---
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
X-Debbugs-Cc: horizon@packages.debian.org
Control: affects -1 + src:horizon
Please unblock package horizon
[ Reason ]
This is a fix for:
https://bugs.debian.org/1108931
What's going on is that Horizon tried to import from a folder
that is gone once the last plugin is removed.
What I did is a simple try/catch thingy, so that it wont
crash, and then not include the enabled code when it does
not exist. The diff is simple and is more easy to understand
than my explanations, I believe.
[ Impact ]
Stack dump in collect_static when removing the last plugin.
[ Tests ]
Tried manually that it fixed, and it indeed works.
[ Risks ]
Not much risk.
[ Checklist ]
[x] all changes are documented in the d/changelog
[x] I reviewed all changes and I approve them
[x] attach debdiff against the package in testing
unblock horizon/3:25.3.0-2
diff --git a/debian/changelog b/debian/changelog
index 49ed3f785..befa030ec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+horizon (3:25.3.0-3) unstable; urgency=medium
+
+ * Refreshed:
+ Dont_load_user_role_assignment_or_groups_tabs_for_non-admins.patch.
+ * Add do-not-import-enabled-if-no-plugins.patch (Closes: #1108931).
+
+ -- Thomas Goirand <zigo@debian.org> Thu, 10 Jul 2025 11:09:04 +0200
+
horizon (3:25.3.0-2) unstable; urgency=medium
* Uploading to unstable.
diff --git a/debian/patches/Dont_load_user_role_assignment_or_groups_tabs_for_non-admins.patch b/debian/patches/Dont_load_user_role_assignment_or_groups_tabs_for_non-admins.patch
index 2846f892c..356401c1a 100644
--- a/debian/patches/Dont_load_user_role_assignment_or_groups_tabs_for_non-admins.patch
+++ b/debian/patches/Dont_load_user_role_assignment_or_groups_tabs_for_non-admins.patch
@@ -21,7 +21,7 @@ Index: horizon/openstack_dashboard/dashboards/identity/users/tabs.py
===================================================================
--- horizon.orig/openstack_dashboard/dashboards/identity/users/tabs.py
+++ horizon/openstack_dashboard/dashboards/identity/users/tabs.py
-@@ -91,6 +91,10 @@ class RoleAssignmentsTab(tabs.TableTab):
+@@ -95,6 +95,10 @@ class RoleAssignmentsTab(tabs.TableTab):
preload = False
policy_rules = (("identity", "identity:list_role_assignments"),)
@@ -32,7 +32,7 @@ Index: horizon/openstack_dashboard/dashboards/identity/users/tabs.py
def get_roleassignmentstable_data(self):
user = self.tab_group.kwargs['user']
-@@ -138,6 +142,10 @@ class GroupsTab(tabs.TableTab):
+@@ -142,6 +146,10 @@ class GroupsTab(tabs.TableTab):
preload = False
policy_rules = (("identity", "identity:list_groups"),)
diff --git a/debian/patches/do-not-import-enabled-if-no-plugins.patch b/debian/patches/do-not-import-enabled-if-no-plugins.patch
new file mode 100644
index 000000000..a53c3332e
--- /dev/null
+++ b/debian/patches/do-not-import-enabled-if-no-plugins.patch
@@ -0,0 +1,57 @@
+Description: Do not import enabled if no plugins
+ Without this patch, removing the *last* plugin form Horizon will crash
+ collect static with:
+ File "/usr/lib/python3/dist-packages/openstack_dashboard/settings.py", line 31, in <module>
+ from openstack_dashboard.local import enabled as local_enabled
+ ImportError: cannot import name 'enabled' from 'openstack_dashboard.local' (/usr/lib/python3/dist-packages/openstack_dashboard/local/__init__.py)
+Author: Thomas Goirand <zigo@debian.org>
+Bug-Debian: https://bugs.debian.org/1108931
+Forwarded: https://review.opendev.org/c/openstack/horizon/+/954568
+Last-Update: 2025-07-10
+
+--- horizon-25.3.0.orig/openstack_dashboard/settings.py
++++ horizon-25.3.0/openstack_dashboard/settings.py
+@@ -28,7 +28,10 @@ from horizon.utils.escape import monkeyp
+
+ from openstack_dashboard import enabled
+ from openstack_dashboard import exceptions
+-from openstack_dashboard.local import enabled as local_enabled
++try:
++ from openstack_dashboard.local import enabled as local_enabled
++except ImportError:
++ pass
+ from openstack_dashboard import theme_settings
+ from openstack_dashboard.utils import config
+ from openstack_dashboard.utils import settings as settings_utils
+@@ -348,14 +351,23 @@ settings_utils.find_static_files(HORIZON
+ THEME_COLLECTION_DIR, ROOT_PATH)
+
+ INSTALLED_APPS = list(INSTALLED_APPS) # Make sure it's mutable
+-settings_utils.update_dashboards(
+- [
+- enabled,
+- local_enabled,
+- ],
+- HORIZON_CONFIG,
+- INSTALLED_APPS,
+-)
++try:
++ settings_utils.update_dashboards(
++ [
++ enabled,
++ local_enabled,
++ ],
++ HORIZON_CONFIG,
++ INSTALLED_APPS,
++ )
++except NameError:
++ settings_utils.update_dashboards(
++ [
++ enabled,
++ ],
++ HORIZON_CONFIG,
++ INSTALLED_APPS,
++ )
+ INSTALLED_APPS[0:0] = ADD_INSTALLED_APPS
+
+ # Include xstatic_modules specified in plugin
diff --git a/debian/patches/series b/debian/patches/series
index 4e14bc922..2d54855ae 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ remove-test_rbac_panels.patch
Allow_non-admins_to_cold_migrate_instances.patch
remove-broken-test-in-bookworm-backports.patch
fix-serial_console.scss.patch
+do-not-import-enabled-if-no-plugins.patch
--- End Message ---