[node-patches] Change in ovirt-node[ovirt-3.6]: valid: add file:// validator
dougsland at redhat.com
dougsland at redhat.com
Thu Aug 18 20:39:15 UTC 2016
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: valid: add file:// validator
......................................................................
valid: add file:// validator
Users can specify file:// to point to a file.
Change-Id: I70f0c92ff91e7a8d8f3e6eeefd2dfa15a1a61271
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1331072
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
(cherry picked from commit fdb14ca0e553abfcf4242ec5a8fc4011a0bd42c4)
---
M src/ovirt/node/valid.py
1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/79/62579/1
diff --git a/src/ovirt/node/valid.py b/src/ovirt/node/valid.py
index 48f77ba..5f77e0d 100644
--- a/src/ovirt/node/valid.py
+++ b/src/ovirt/node/valid.py
@@ -327,6 +327,13 @@
return is_valid
+class FileURL(Validator):
+ description = "a valid file URL"
+
+ def validate(self, value):
+ return value.startswith("file://") and os.path.isfile(value[7:])
+
+
class Ascii(Validator):
""" Checks if the param is ascii or not.
--
To view, visit https://gerrit.ovirt.org/62579
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I70f0c92ff91e7a8d8f3e6eeefd2dfa15a1a61271
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>
More information about the node-patches
mailing list