[node-patches] Change in ovirt-node[master]: Fix the text for netmask validators
rbarry at redhat.com
rbarry at redhat.com
Thu May 7 00:52:23 UTC 2015
Ryan Barry has uploaded a new change for review.
Change subject: Fix the text for netmask validators
......................................................................
Fix the text for netmask validators
Add a netmask validator with the right text. We could go full-bore
and add a CIDR validator pretty easily as well, but then it'd be
a large change with modifications to config.defaults.Network and
ovirt.node.config.network, which isn't worth it at the moment,
since we can just explicitly tell users to use dot.decimal format
Change-Id: I25856f1a6df4c926063b8b5efc2807e73771d416
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1155508
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/setup/core/network_page.py
M src/ovirt/node/valid.py
2 files changed, 17 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/37/40637/1
diff --git a/src/ovirt/node/setup/core/network_page.py b/src/ovirt/node/setup/core/network_page.py
index 3baa3ac..e1b6597 100644
--- a/src/ovirt/node/setup/core/network_page.py
+++ b/src/ovirt/node/setup/core/network_page.py
@@ -183,7 +183,7 @@
"ntp[1]": fqdn_ip_or_empty,
"dialog.nic.ipv4.address": valid.IPv4Address() | valid.Empty(),
- "dialog.nic.ipv4.netmask": valid.IPv4Address() | valid.Empty(),
+ "dialog.nic.ipv4.netmask": valid.Netmask() | valid.Empty(),
"dialog.nic.ipv4.gateway": valid.IPv4Address() | valid.Empty(),
"dialog.nic.ipv6.address": valid.IPv6Address() | valid.Empty(),
"dialog.nic.ipv6.netmask": (valid.Number(bounds=[0, 128]) |
diff --git a/src/ovirt/node/valid.py b/src/ovirt/node/valid.py
index 6a1b0e9..debfa4e 100644
--- a/src/ovirt/node/valid.py
+++ b/src/ovirt/node/valid.py
@@ -439,6 +439,22 @@
family = socket.AF_INET6
+class Netmask(IPv4Address):
+ """ Validates dot.decimal netmasks
+
+ >>> Netmask()("255.255.255.0")
+ True
+ >>> Netmask()("255.0.0.0")
+ True
+ >>> Netmask().validate("256.")
+ False
+ >>> Netmask().validate("")
+ False
+ """
+
+ description = "a valid IPv4 netmask in dot.decimal format"
+
+
class IPAddress(Validator):
"""Allows any IPv4 or IPv6 address
--
To view, visit https://gerrit.ovirt.org/40637
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I25856f1a6df4c926063b8b5efc2807e73771d416
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>
More information about the node-patches
mailing list