summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Peck <bpeck@redhat.com>2011-03-11 05:12:35 +1000
committerGerrit Code Review <gerrit@maeby.djc.id.au>2011-03-11 05:12:35 +1000
commitbd864e237d14708f14c60b4bcec7cb32a3b972e4 (patch)
treec22e89ce598ed64a4f01c4b1bbf96be6927bff70
parent2367e74ca19ef4e3f2c405298e34e717f339ba8a (diff)
parent78eb89286be9c48eb9c95a73ee859e05e6dde72c (diff)
Merge "force hostnames to lowercase" into develop
-rw-r--r--SchemaUpgrades/upgrade_0.6.7.txt6
-rw-r--r--Server/bkr/server/test/selenium/test_system_view.py10
-rw-r--r--Server/bkr/server/widgets.py4
3 files changed, 20 insertions, 0 deletions
diff --git a/SchemaUpgrades/upgrade_0.6.7.txt b/SchemaUpgrades/upgrade_0.6.7.txt
new file mode 100644
index 0000000..454eed1
--- /dev/null
+++ b/SchemaUpgrades/upgrade_0.6.7.txt
@@ -0,0 +1,6 @@
+Update all existing FQDNs to lowercase
+--------------------------------------
+
+Run the following SQL statement (expected run time <5sec):
+
+ UPDATE system SET fqdn = LOWER(fqdn);
diff --git a/Server/bkr/server/test/selenium/test_system_view.py b/Server/bkr/server/test/selenium/test_system_view.py
index 42c4ba1..d25ceba 100644
--- a/Server/bkr/server/test/selenium/test_system_view.py
+++ b/Server/bkr/server/test/selenium/test_system_view.py
@@ -136,6 +136,16 @@ class SystemViewTest(SeleniumTestCase):
self.assertEquals(sel.get_text('css=.fielderror'),
'The supplied value is not a valid hostname')
+ # https://bugzilla.redhat.com/show_bug.cgi?id=683003
+ def test_forces_fqdn_to_lowercase(self):
+ self.login()
+ sel = self.selenium
+ self.go_to_system_view()
+ sel.type('fqdn', 'LooOOooL')
+ sel.click('link=Save Changes')
+ sel.wait_for_page_to_load('30000')
+ self.assertEquals(sel.get_value('fqdn'), 'looooool')
+
# https://bugzilla.redhat.com/show_bug.cgi?id=670912
def test_renaming_system_removes_from_cobbler(self):
self.login()
diff --git a/Server/bkr/server/widgets.py b/Server/bkr/server/widgets.py
index 71e0959..fcbb78d 100644
--- a/Server/bkr/server/widgets.py
+++ b/Server/bkr/server/widgets.py
@@ -33,6 +33,10 @@ class Hostname(validators.Regex):
r'(?:(?:[0-9A-Za-z]|\b-){0,61}[0-9A-Za-z])?'
r'(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|\b-){0,61}[0-9A-Za-z])?)*\.?$',
strip=True)
+ def _to_python(self, value, state):
+ # Hostnames are case-insensitive, so let's force it to lowercase here
+ # for consistency
+ return super(Hostname, self)._to_python(value, state).lower()
class UtilJSON:
@classmethod