[node-patches] Change in ovirt-node[master]: valid: Allow digit-only hostnames

fabiand at fedoraproject.org fabiand at fedoraproject.org
Tue Mar 5 16:15:43 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: valid: Allow digit-only hostnames
......................................................................

valid: Allow digit-only hostnames

RFC 1123 [0] allows digit-only hostnames, this is now respected in the
FQDN validation class.

[0] http://tools.ietf.org/html/rfc1123

Change-Id: I5fa1ece905a5f8ae43abf5690b18e572984242b6
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/config/defaults.py
M scripts/tui/src/ovirt/node/valid.py
2 files changed, 10 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/33/12733/1

diff --git a/scripts/tui/src/ovirt/node/config/defaults.py b/scripts/tui/src/ovirt/node/config/defaults.py
index 181108c..f301ea1 100644
--- a/scripts/tui/src/ovirt/node/config/defaults.py
+++ b/scripts/tui/src/ovirt/node/config/defaults.py
@@ -550,7 +550,7 @@
 
     >>> fn = "/tmp/cfg_dummy"
     >>> cfgfile = ConfigFile(fn, SimpleProvider)
-    >>> servers = ["10.0.0.4", "10.0.0.5"]
+    >>> servers = ["10.0.0.4", "10.0.0.5", "0.example.com"]
     >>> n = Timeservers(cfgfile)
     >>> n.update(servers)
     >>> data = n.retrieve()
diff --git a/scripts/tui/src/ovirt/node/valid.py b/scripts/tui/src/ovirt/node/valid.py
index 5c70c94..3165361 100644
--- a/scripts/tui/src/ovirt/node/valid.py
+++ b/scripts/tui/src/ovirt/node/valid.py
@@ -263,15 +263,21 @@
 
     >>> FQDN()("example.com")
     True
+    >>> FQDN().validate("example")
+    True
+    >>> FQDN()("0.example.com")
+    True
     >>> FQDN().validate("example.com.")
+    False
+    >>> FQDN().validate(".com")
     False
     >>> FQDN().validate("")
     False
     """
 
     description = "a valid FQDN"
-    pattern = ("^(([a-z]|[a-z][a-z0-9\-]*[a-z0-9])\.)" +
-               "*([a-z]|[a-z][a-z0-9\-]*[a-z0-9])$", re.I)
+    pattern = ("^(([0-9]\.)?([a-z]|[a-z][a-z0-9\-]*[a-z0-9])\.)*" +
+               "([a-z]|[a-z][a-z0-9\-]*[a-z0-9])$", re.I)
 
 
 class IPv4Address(Validator):
@@ -421,9 +427,7 @@
 
     >>> IQN()("iqn.1994-05.com.redhat.com:6edea1b458e5")
     True
-    >>> FQDN().validate("example.com.")
-    False
-    >>> FQDN().validate("")
+    >>> IQN().validate("")
     False
     """
 


--
To view, visit http://gerrit.ovirt.org/12733
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5fa1ece905a5f8ae43abf5690b18e572984242b6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list