From d1f130dd75a274cf59f8195dc22e99b94acfa5e2 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Mon, 21 Mar 2016 14:55:50 +0000 Subject: [PATCH] Cleanups in the patch folder. Rewritten-From: 9a7609c72e265a710054eff965ac712ad903f4b6 --- .../0090-explicitly-declare-app_label.patch | 35 ---- ...add-openstack_auth-in-INSTALLED_APPS.patch | 17 -- xenial/debian/patches/1.patch | 69 -------- ...ort_selenium_if_WITH_SELENIUM_is_set.patch | 164 ------------------ ...methods_to_check_for_disabled_panels.patch | 105 ----------- xenial/debian/patches/series | 5 - 6 files changed, 395 deletions(-) delete mode 100644 xenial/debian/patches/0090-explicitly-declare-app_label.patch delete mode 100644 xenial/debian/patches/0100-add-openstack_auth-in-INSTALLED_APPS.patch delete mode 100644 xenial/debian/patches/1.patch delete mode 100644 xenial/debian/patches/Only_import_selenium_if_WITH_SELENIUM_is_set.patch delete mode 100644 xenial/debian/patches/Provide_2_simple_methods_to_check_for_disabled_panels.patch diff --git a/xenial/debian/patches/0090-explicitly-declare-app_label.patch b/xenial/debian/patches/0090-explicitly-declare-app_label.patch deleted file mode 100644 index f021be8..0000000 --- a/xenial/debian/patches/0090-explicitly-declare-app_label.patch +++ /dev/null @@ -1,35 +0,0 @@ -Description: Explicitly declares app_label -Author: Thomas Goirand -Forwarded: no -Last-Update: 2016-02-19 - -Index: horizon/horizon/test/settings.py -=================================================================== ---- horizon.orig/horizon/test/settings.py -+++ horizon/horizon/test/settings.py -@@ -169,3 +169,5 @@ LOGGING = { - } - } - } -+ -+APP_LABEL = 'horizon' -Index: horizon/openstack_dashboard/local/local_settings.py.example -=================================================================== ---- horizon.orig/openstack_dashboard/local/local_settings.py.example -+++ horizon/openstack_dashboard/local/local_settings.py.example -@@ -720,3 +720,5 @@ REST_API_REQUIRED_SETTINGS = ['OPENSTACK - # For more information see: - # http://tinyurl.com/anticlickjack - #DISALLOW_IFRAME_EMBED = True -+ -+APP_LABEL = 'horizon' -Index: horizon/openstack_dashboard/test/settings.py -=================================================================== ---- horizon.orig/openstack_dashboard/test/settings.py -+++ horizon/openstack_dashboard/test/settings.py -@@ -236,3 +236,5 @@ REST_API_SETTING_2 = 'bar' - REST_API_SECURITY = 'SECURITY' - REST_API_REQUIRED_SETTINGS = ['REST_API_SETTING_1'] - REST_API_ADDITIONAL_SETTINGS = ['REST_API_SETTING_2'] -+ -+APP_LABEL = 'horizon' diff --git a/xenial/debian/patches/0100-add-openstack_auth-in-INSTALLED_APPS.patch b/xenial/debian/patches/0100-add-openstack_auth-in-INSTALLED_APPS.patch deleted file mode 100644 index 025de34..0000000 --- a/xenial/debian/patches/0100-add-openstack_auth-in-INSTALLED_APPS.patch +++ /dev/null @@ -1,17 +0,0 @@ -Description: Add openstack_auth in INSTALLED_APPS -Author: Thomas Goirand -Forwarded: no -Last-Update: 2016-01-11 - ---- horizon-9.0.0~b2+2016.02.18.git.cda9604792.orig/horizon/test/settings.py -+++ horizon-9.0.0~b2+2016.02.18.git.cda9604792/horizon/test/settings.py -@@ -59,7 +59,8 @@ INSTALLED_APPS = ( - 'horizon', - 'horizon.test', - 'horizon.test.test_dashboards.cats', -- 'horizon.test.test_dashboards.dogs' -+ 'horizon.test.test_dashboards.dogs', -+ 'openstack_auth' - ) - - MIDDLEWARE_CLASSES = ( diff --git a/xenial/debian/patches/1.patch b/xenial/debian/patches/1.patch deleted file mode 100644 index 5f78197..0000000 --- a/xenial/debian/patches/1.patch +++ /dev/null @@ -1,69 +0,0 @@ -Description: - TODO: Put a short summary on the line above and replace this paragraph - with a longer explanation of this change. Complete the meta-information - with other relevant fields (see below for details). To make it easier, the - information below has been extracted from the changelog. Adjust it or drop - it. - . - horizon (2:9.0.0~b2+2016.02.18.git.cda9604792-1) experimental; urgency=medium - . - * New upstream release, based on commit cda9604792. - * Fixed (build-)depends for this release. - * Added patch: Provide_2_simple_methods_to_check_for_disabled_panels.patch - * Added patch: 0100-add-openstack_auth-in-INSTALLED_APPS.patch - * Added patch: 0090-explicitly-declare-app_label.patch - * Added patch: Fix_remaining_Django_1.9_test_failures.patch - * Added patch: Only_import_selenium_if_WITH_SELENIUM_is_set.patch -Author: Thomas Goirand - ---- -The information above should follow the Patch Tagging Guidelines, please -checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here -are templates for supplementary fields that you might want to add: - -Origin: , -Bug: -Bug-Debian: https://bugs.debian.org/ -Bug-Ubuntu: https://launchpad.net/bugs/ -Forwarded: -Reviewed-By: -Last-Update: - ---- horizon-9.0.0~b2+2016.02.18.git.cda9604792.orig/horizon/test/webdriver.py -+++ horizon-9.0.0~b2+2016.02.18.git.cda9604792/horizon/test/webdriver.py -@@ -45,21 +45,21 @@ if with_sel: - desired_capabilities = dc.DesiredCapabilities.FIREFOX - - --class WrapperFindOverride(object): -- """Mixin for overriding find_element methods.""" -+ class WrapperFindOverride(object): -+ """Mixin for overriding find_element methods.""" - -- def find_element(self, by=by.By.ID, value=None): -- web_el = super(WrapperFindOverride, self).find_element(by, value) -- return WebElementWrapper(web_el.parent, web_el.id, (by, value), -- self) -- -- def find_elements(self, by=by.By.ID, value=None): -- web_els = super(WrapperFindOverride, self).find_elements(by, value) -- result = [] -- for index, web_el in enumerate(web_els): -- result.append(WebElementWrapper(web_el.parent, web_el.id, -- (by, value), self, index)) -- return result -+ def find_element(self, by=by.By.ID, value=None): -+ web_el = super(WrapperFindOverride, self).find_element(by, value) -+ return WebElementWrapper(web_el.parent, web_el.id, (by, value), -+ self) -+ -+ def find_elements(self, by=by.By.ID, value=None): -+ web_els = super(WrapperFindOverride, self).find_elements(by, value) -+ result = [] -+ for index, web_el in enumerate(web_els): -+ result.append(WebElementWrapper(web_el.parent, web_el.id, -+ (by, value), self, index)) -+ return result - - - class WebElementWrapper(WrapperFindOverride, webelement.WebElement): diff --git a/xenial/debian/patches/Only_import_selenium_if_WITH_SELENIUM_is_set.patch b/xenial/debian/patches/Only_import_selenium_if_WITH_SELENIUM_is_set.patch deleted file mode 100644 index c74cdff..0000000 --- a/xenial/debian/patches/Only_import_selenium_if_WITH_SELENIUM_is_set.patch +++ /dev/null @@ -1,164 +0,0 @@ -Subject: Only import selenium if WITH_SELENIUM is set - here's some unit tests errors in Debian when building the Horizon package, - because of missing conditionals when importing the selenium Python modules. - This patch fixes it. -Author: Thomas Goirand -Date: Fri, 19 Feb 2016 16:23:04 +0000 -Change-Id: I7e0c10f8a7dfe213d1b471a58bbef378bc80a615 -Forwarded: https://review.openstack.org/#/c/282410/ -Last-Update: 2016-02-20 - -diff --git a/horizon/test/firefox_binary.py b/horizon/test/firefox_binary.py -index 2597789..caacc88 100644 ---- a/horizon/test/firefox_binary.py -+++ b/horizon/test/firefox_binary.py -@@ -11,64 +11,68 @@ - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. -+import os - import platform - import shutil - import subprocess - --from selenium.common import exceptions as selenium_exceptions --from selenium.webdriver.common import desired_capabilities as dc --from selenium.webdriver import firefox -+with_sel = os.environ.get('WITH_SELENIUM', False) -+if with_sel: -+ from selenium.common import exceptions as selenium_exceptions -+ from selenium.webdriver.common import desired_capabilities as dc -+ from selenium.webdriver import firefox - - --class FirefoxBinary(firefox.firefox_binary.FirefoxBinary): -- """Workarounds selenium firefox issues. -+ class FirefoxBinary(firefox.firefox_binary.FirefoxBinary): -+ """Workarounds selenium firefox issues. - -- There is race condition in the way firefox is spawned. The exact -- cause hasn't been properly diagnosed yet but it's around: -+ There is race condition in the way firefox is spawned. The exact -+ cause hasn't been properly diagnosed yet but it's around: - -- - getting a free port from the OS with -- selenium.webdriver.common.utils free_port(), -+ - getting a free port from the OS with -+ selenium.webdriver.common.utils free_port(), - -- - release the port immediately but record it in ff prefs so that ff -- can listen on that port for the internal http server. -+ - release the port immediately but record it in ff prefs so that ff -+ can listen on that port for the internal http server. - -- It has been observed that this leads to hanging processes for -- 'firefox -silent'. -- """ -+ It has been observed that this leads to hanging processes for -+ 'firefox -silent'. -+ """ - -- def _start_from_profile_path(self, path): -- self._firefox_env["XRE_PROFILE_PATH"] = path -+ def _start_from_profile_path(self, path): -+ self._firefox_env["XRE_PROFILE_PATH"] = path - -- if platform.system().lower() == 'linux': -- self._modify_link_library_path() -- command = [self._start_cmd, "-silent"] -- if self.command_line is not None: -- for cli in self.command_line: -- command.append(cli) -+ if platform.system().lower() == 'linux': -+ self._modify_link_library_path() -+ command = [self._start_cmd, "-silent"] -+ if self.command_line is not None: -+ for cli in self.command_line: -+ command.append(cli) - - # The following exists upstream and is known to create hanging - # firefoxes, leading to zombies. --# subprocess.Popen(command, stdout=self._log_file, --# stderr=subprocess.STDOUT, --# env=self._firefox_env).communicate() -- command[1] = '-foreground' -- self.process = subprocess.Popen( -- command, stdout=self._log_file, stderr=subprocess.STDOUT, -- env=self._firefox_env) -+# subprocess.Popen(command, stdout=self._log_file, -+# stderr=subprocess.STDOUT, -+# env=self._firefox_env).communicate() -+ command[1] = '-foreground' -+ self.process = subprocess.Popen( -+ command, stdout=self._log_file, stderr=subprocess.STDOUT, -+ env=self._firefox_env) - - --class WebDriver(firefox.webdriver.WebDriver): -- """Workarounds selenium firefox issues.""" -- def __init__(self, firefox_profile=None, firefox_binary=None, timeout=30, -- desired_capabilities=dc.DesiredCapabilities.FIREFOX, -- proxy=None): -- try: -- super(WebDriver, self).__init__( -- firefox_profile, FirefoxBinary(), timeout, -- desired_capabilities, proxy) -- except selenium_exceptions.WebDriverException: -- # If we can't start, cleanup profile -- shutil.rmtree(self.profile.path) -- if self.profile.tempfolder is not None: -- shutil.rmtree(self.profile.tempfolder) -- raise -+ class WebDriver(firefox.webdriver.WebDriver): -+ """Workarounds selenium firefox issues.""" -+ def __init__(self, firefox_profile=None, firefox_binary=None, -+ timeout=30, -+ desired_capabilities=dc.DesiredCapabilities.FIREFOX, -+ proxy=None): -+ try: -+ super(WebDriver, self).__init__( -+ firefox_profile, FirefoxBinary(), timeout, -+ desired_capabilities, proxy) -+ except selenium_exceptions.WebDriverException: -+ # If we can't start, cleanup profile -+ shutil.rmtree(self.profile.path) -+ if self.profile.tempfolder is not None: -+ shutil.rmtree(self.profile.tempfolder) -+ raise -diff --git a/horizon/test/webdriver.py b/horizon/test/webdriver.py -index 2a699fc..83b2701 100644 ---- a/horizon/test/webdriver.py -+++ b/horizon/test/webdriver.py -@@ -29,18 +29,20 @@ class ElementNotReloadableException(Exception): - pass - - --from selenium.common import exceptions --from selenium.webdriver.common import by --from selenium.webdriver.common import desired_capabilities as dc --from selenium.webdriver.remote import webelement -- --# Select the WebDriver to use based on the --selenium-phantomjs switch. --if os.environ.get('SELENIUM_PHANTOMJS'): -- from selenium.webdriver import PhantomJS as WebDriver -- desired_capabilities = dc.DesiredCapabilities.PHANTOMJS --else: -- from horizon.test.firefox_binary import WebDriver -- desired_capabilities = dc.DesiredCapabilities.FIREFOX -+with_sel = os.environ.get('WITH_SELENIUM', False) -+if with_sel: -+ from selenium.common import exceptions -+ from selenium.webdriver.common import by -+ from selenium.webdriver.common import desired_capabilities as dc -+ from selenium.webdriver.remote import webelement -+ -+ # Select the WebDriver to use based on the --selenium-phantomjs switch. -+ if os.environ.get('SELENIUM_PHANTOMJS'): -+ from selenium.webdriver import PhantomJS as WebDriver -+ desired_capabilities = dc.DesiredCapabilities.PHANTOMJS -+ else: -+ from horizon.test.firefox_binary import WebDriver -+ desired_capabilities = dc.DesiredCapabilities.FIREFOX - - - class WrapperFindOverride(object): diff --git a/xenial/debian/patches/Provide_2_simple_methods_to_check_for_disabled_panels.patch b/xenial/debian/patches/Provide_2_simple_methods_to_check_for_disabled_panels.patch deleted file mode 100644 index 83f62de..0000000 --- a/xenial/debian/patches/Provide_2_simple_methods_to_check_for_disabled_panels.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 2510cbe01018d22de1f0a7e93dce5ffc82faed73 Mon Sep 17 00:00:00 2001 -From: Itxaka -Date: Wed, 3 Feb 2016 17:37:59 +0100 -Subject: [PATCH] Provide 2 simple methods to check for disabled panels - -Modify settings so we track disabled panels and dashboards -Provide a helper to check if either the dashboard or the -dashboard+panel is enabled/disabled -Provides an example guard on the admin->images tests. - -Change-Id: I65332bdf61e9ed15aaa2138ee08c61cc91347d1d -Closes-Bug: #1541489 ---- - openstack_dashboard/dashboards/admin/images/tests.py | 5 +++++ - openstack_dashboard/test/helpers.py | 12 ++++++++++++ - openstack_dashboard/utils/settings.py | 11 +++++++++++ - 3 files changed, 28 insertions(+) - -Index: horizon/openstack_dashboard/dashboards/admin/images/tests.py -=================================================================== ---- horizon.orig/openstack_dashboard/dashboards/admin/images/tests.py -+++ horizon/openstack_dashboard/dashboards/admin/images/tests.py -@@ -16,6 +16,7 @@ from django.conf import settings - from django.core.urlresolvers import reverse - from django import http - from django.test.utils import override_settings -+import unittest - - from mox3.mox import IsA # noqa - -@@ -25,6 +26,8 @@ from openstack_dashboard.test import hel - from openstack_dashboard.dashboards.admin.images import tables - - -+@unittest.skipIf(test.is_disabled('admin', 'images'), -+ 'Dashboard or panel disabled') - class ImageCreateViewTest(test.BaseAdminViewTests): - @test.create_stubs({api.glance: ('image_list_detailed',)}) - def test_admin_image_create_view_uses_admin_template(self): -@@ -42,6 +45,8 @@ class ImageCreateViewTest(test.BaseAdmin - self.assertTemplateUsed(res, 'admin/images/create.html') - - -+@unittest.skipIf(test.is_disabled('admin', 'images'), -+ 'Dashboard or panel disabled') - class ImagesViewTest(test.BaseAdminViewTests): - @test.create_stubs({api.glance: ('image_list_detailed',), - api.keystone: ('tenant_list',)}) -Index: horizon/openstack_dashboard/test/helpers.py -=================================================================== ---- horizon.orig/openstack_dashboard/test/helpers.py -+++ horizon/openstack_dashboard/test/helpers.py -@@ -632,3 +632,15 @@ class update_settings(django_test_utils. - copied.update(new_value) - kwargs[key] = copied - super(update_settings, self).__init__(**kwargs) -+ -+ -+def is_disabled(dashboard, panel=None): -+ """Return bool indicating if this dashboard or panel is disabled -+ """ -+ if dashboard in settings.HORIZON_CONFIG['disabled_dashboards']: -+ return True -+ if panel: -+ return bool( -+ panel in settings.HORIZON_CONFIG['disabled_panels'].get(dashboard) -+ ) -+ return False -Index: horizon/openstack_dashboard/utils/settings.py -=================================================================== ---- horizon.orig/openstack_dashboard/utils/settings.py -+++ horizon/openstack_dashboard/utils/settings.py -@@ -100,6 +100,7 @@ def update_dashboards(modules, horizon_c - - enabled_dashboards = [] - disabled_dashboards = [] -+ disabled_panels = {} - exceptions = horizon_config.get('exceptions', {}) - apps = [] - angular_modules = [] -@@ -109,7 +110,15 @@ def update_dashboards(modules, horizon_c - panel_customization = [] - update_horizon_config = {} - for key, config in import_dashboard_config(modules): -+ if config.get('REMOVE_PANEL'): -+ disabled_panels.setdefault( -+ config.get('PANEL_DASHBOARD'), [] -+ ).extend([config.get('PANEL')]) - if config.get('DISABLED', False): -+ if config.get('PANEL'): -+ disabled_panels.setdefault( -+ config.get('PANEL_DASHBOARD'), [] -+ ).extend([config.get('PANEL')]) - if config.get('DASHBOARD'): - disabled_dashboards.append(config.get('DASHBOARD')) - continue -@@ -153,6 +162,8 @@ def update_dashboards(modules, horizon_c - - horizon_config['panel_customization'] = panel_customization - horizon_config['dashboards'] = tuple(dashboards) -+ horizon_config['disabled_dashboards'] = [d for d in disabled_dashboards] -+ horizon_config['disabled_panels'] = disabled_panels - horizon_config.setdefault('exceptions', {}).update(exceptions) - horizon_config.update(update_horizon_config) - horizon_config.setdefault('angular_modules', []).extend(angular_modules) diff --git a/xenial/debian/patches/series b/xenial/debian/patches/series index f6162b3..b27c3cf 100644 --- a/xenial/debian/patches/series +++ b/xenial/debian/patches/series @@ -2,9 +2,4 @@ fix-dashboard-django-wsgi.patch fix-dashboard-manage.patch fixed-horizon-MANIFEST.in.patch enable_identity_users_panel.patch -#Provide_2_simple_methods_to_check_for_disabled_panels.patch -#0100-add-openstack_auth-in-INSTALLED_APPS.patch -#0090-explicitly-declare-app_label.patch Fix_remaining_Django_1.9_test_failures.patch -#Only_import_selenium_if_WITH_SELENIUM_is_set.patch -#1.patch -- 2.45.2