Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: modified validation of fqdn input during setup
......................................................................

packaging: modified validation of fqdn input during setup

validateFQDN now explicitly states that an IP address is not
supported instead of just saying "<ip address here> did not resolve
to an ip address. User input failed validation..."

Change-Id: I99d3727f0e2205f6cd90ff5c2a003fb6f0643eab
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=843623
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M packaging/fedora/setup/engine_validators.py
M packaging/fedora/setup/output_messages.py
2 files changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/28/14528/1

diff --git a/packaging/fedora/setup/engine_validators.py 
b/packaging/fedora/setup/engine_validators.py
index ed7b483..0997945 100644
--- a/packaging/fedora/setup/engine_validators.py
+++ b/packaging/fedora/setup/engine_validators.py
@@ -305,6 +305,12 @@
 
 def validateFQDN(param, options=[]):
     logging.info("Validating %s as a FQDN"%(param))
+    # Ensure that it isn't an IP address.
+    if re.match("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}", param):
+        logging.error(output_messages.ERR_CANT_USE_IP_AS_FQDN % (param))
+        print output_messages.ERR_CANT_USE_IP_AS_FQDN % (param)
+        return False
+
     if not validateDomain(param,options):
         return False
     try:
diff --git a/packaging/fedora/setup/output_messages.py 
b/packaging/fedora/setup/output_messages.py
index cd66e57..2141da8 100644
--- a/packaging/fedora/setup/output_messages.py
+++ b/packaging/fedora/setup/output_messages.py
@@ -370,6 +370,8 @@
 ERR_IPS_NOT_CONFIGED_ON_INT="The IP (%s) which was resolved from the FQDN %s 
is not configured on any interface on this host"
 ERR_IPS_HAS_NO_PTR="None of the IP addresses on this host(%s) holds a PTR 
record for the FQDN: %s"
 ERR_IP_HAS_NO_PTR="The IP %s does not hold a PTR record for the FQDN: %s"
+ERR_CANT_USE_IP_AS_FQDN="%s is an IP address and not a FQDN. A FQDN is needed \
+to be able to generate certificates correctly."
 
 #init logging
 ERR_EXP_FAILED_INIT_LOGGER="Unexpected error: Failed to initiate logger, 
please check file system permission"


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99d3727f0e2205f6cd90ff5c2a003fb6f0643eab
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: engine_3.2
Gerrit-Owner: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to