URL: https://github.com/freeipa/freeipa/pull/903
Author: felipevolpone
 Title: #903: Warning the user when using a loopback IP as forwarder
Action: opened

PR body:
"""
Now, the user can pass a loopback IP in the --forwarder option.
Previously, an error would be raised, now we just show a warning message.

Fixes: https://pagure.io/freeipa/issue/5801
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/903/head:pr903
git checkout pr903
From d47baf6ac41649fc241c0d1df00bdf3b2d2c33fb Mon Sep 17 00:00:00 2001
From: Felipe Volpone <felipevolp...@gmail.com>
Date: Wed, 5 Jul 2017 14:23:19 -0300
Subject: [PATCH] Warning the user when using a loopback IP as forwarder,
 instead of raising error

Now, the user can pass a loopback IP in the --forwarder option.
Previously an error wuold be raised, now we just show a warning
message.

https://pagure.io/freeipa/issue/5801
---
 ipapython/config.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ipapython/config.py b/ipapython/config.py
index 19abfc51ee..71f19a1b2d 100644
--- a/ipapython/config.py
+++ b/ipapython/config.py
@@ -31,7 +31,7 @@
 from six.moves.configparser import SafeConfigParser
 from six.moves.urllib.parse import urlsplit
 # pylint: enable=import-error
-
+from ipapython.ipa_log_manager import root_logger
 from ipapython.dn import DN
 
 try:
@@ -69,7 +69,12 @@ def check_ip_option(option, opt, value):
     from ipapython.ipautil import CheckedIPAddress
 
     try:
-        return CheckedIPAddress(value)
+        allow_loopback = False
+        if opt == '--forwarder':
+            allow_loopback = True
+            root_logger.warning("You're using a loopback IP address {}".format(value))
+
+        return CheckedIPAddress(value, allow_loopback=allow_loopback)
     except Exception as e:
         raise OptionValueError("option %s: invalid IP address %s: %s" % (opt, value, e))
 
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to