diff options
| author | Jan Cholasta <jcholast@redhat.com> | 2016-11-07 14:01:10 +0100 |
|---|---|---|
| committer | Jan Cholasta <jcholast@redhat.com> | 2016-11-11 12:17:25 +0100 |
| commit | a929ac333833a5cbf503d1fcbdee150658d933a4 (patch) | |
| tree | 48ba4ca356525b8433507a17bee4ebbfd719b506 /ipaserver/install/server | |
| parent | 9fd1981ae8abf720f5234b6049c9beabbb1f2211 (diff) | |
| download | freeipa-a929ac333833a5cbf503d1fcbdee150658d933a4.tar.gz freeipa-a929ac333833a5cbf503d1fcbdee150658d933a4.tar.xz freeipa-a929ac333833a5cbf503d1fcbdee150658d933a4.zip | |
install: use standard Python classes to declare knob types
Use type(None) rather than bool to define knobs which are represented as
command line flags. This allows declaring both "--option" and
"--option={0,1}"-style command line options.
Use enum.Enum subclasses instead of set literals to declare enumerations.
Use typing.List[T] instead of (list, T) to declare lists. (Note that a
minimal reimplementation of typing.List is used instead of the Python 2
backport of the typing module due to non-technical reasons.)
Use CheckedIPAddress instead of 'ip' and 'ip-local' to declare IP
addresses.
https://fedorahosted.org/freeipa/ticket/6392
Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipaserver/install/server')
| -rw-r--r-- | ipaserver/install/server/common.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ipaserver/install/server/common.py b/ipaserver/install/server/common.py index e6093d15c..ad3282af8 100644 --- a/ipaserver/install/server/common.py +++ b/ipaserver/install/server/common.py @@ -10,6 +10,7 @@ import sys import six from ipapython.dn import DN +from ipapython.ipautil import CheckedIPAddress from ipapython.install import common, core from ipapython.install.core import Knob from ipalib.util import validate_domain_name @@ -308,13 +309,22 @@ class BaseServer(common.Installable, common.Interactive, core.Composite): ) ip_addresses = Knob( - (list, 'ip-local'), None, + (list, 'ip'), None, description=("Master Server IP Address. This option can be used " "multiple times"), cli_name='ip-address', cli_metavar='IP_ADDRESS', ) + @ip_addresses.validator + def ip_addresses(self, values): + for value in values: + try: + CheckedIPAddress(value, match_local=True) + except Exception as e: + raise ValueError("invalid IP address {0}: {1}".format( + value, e)) + no_host_dns = Knob( bool, False, description="Do not use DNS for hostname lookup during installation", |
