diff options
author | Jan Cholasta <jcholast@redhat.com> | 2015-07-08 06:21:02 +0000 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2015-07-08 12:36:19 +0000 |
commit | 232458a222435c80c28d6179f164673de67e2544 (patch) | |
tree | 53098e7d7ebb451c8b24e63a31892a49b1500d27 | |
parent | bf6df3df9b388753a52a0040d9c15b1eabce41ca (diff) | |
download | freeipa-232458a222435c80c28d6179f164673de67e2544.tar.gz freeipa-232458a222435c80c28d6179f164673de67e2544.tar.xz freeipa-232458a222435c80c28d6179f164673de67e2544.zip |
ipalib: Fix skip_version_check option
This reverts commit ea7f392bb98c1f1c4558ec5d6e84ee7a7c613474.
The option can be either set in IPA config file or specified as
'ipa -e skip_version_check=1 [COMMAND]'.
https://fedorahosted.org/freeipa/ticket/4768
Reviewed-By: Martin Basti <mbasti@redhat.com>
-rw-r--r-- | ipa-client/man/default.conf.5 | 3 | ||||
-rw-r--r-- | ipalib/frontend.py | 7 | ||||
-rw-r--r-- | ipalib/plugable.py | 8 |
3 files changed, 9 insertions, 9 deletions
diff --git a/ipa-client/man/default.conf.5 b/ipa-client/man/default.conf.5 index e345e9300..75b9f86bc 100644 --- a/ipa-client/man/default.conf.5 +++ b/ipa-client/man/default.conf.5 @@ -166,6 +166,9 @@ Specifies how the expiration of a session is computed. With \fBinactivity_timeou .B server <hostname> Specifies the IPA Server hostname. .TP +.B skip_version_check <boolean> +Skip client vs. server API version checking. Can lead to errors/strange behavior when newer clients talk to older servers. Use with caution. +.TP .B startup_timeout <time in seconds> Controls the amount of time waited when starting a service. The default value is 120 seconds. .TP diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 3a59838d7..2ca3aaea8 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -26,6 +26,7 @@ from distutils import version from ipapython.version import API_VERSION from ipapython.ipa_log_manager import root_logger +from ipalib.capabilities import VERSION_WITHOUT_CAPABILITIES from base import NameSpace from plugable import Plugin from parameters import create_param, Param, Str, Flag, Password @@ -423,7 +424,9 @@ class Command(HasParam): version_provided = 'version' in options if version_provided: self.verify_client_version(unicode(options['version'])) - elif self.api.env.in_server or not self.api.env.skip_version_check: + elif self.api.env.skip_version_check and not self.api.env.in_server: + options['version'] = VERSION_WITHOUT_CAPABILITIES + else: options['version'] = API_VERSION params = self.args_options_2_params(*args, **options) self.debug( @@ -451,7 +454,7 @@ class Command(HasParam): ): ret['summary'] = self.get_summary_default(ret) if self.use_output_validation and (self.output or ret is not None): - self.validate_output(ret, options.get('version', API_VERSION)) + self.validate_output(ret, options['version']) return ret def soft_validate(self, values): diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 269d58092..2ce7acfd6 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -484,12 +484,6 @@ class API(ReadOnly): dest='fallback', help='Only use the server configured in /etc/ipa/default.conf' ) - parser.add_option( - '--skip-version-check', - action='store_true', - dest='skip_version_check', - help=optparse.SUPPRESS_HELP - ) return parser @@ -509,7 +503,7 @@ class API(ReadOnly): pass overrides[str(key.strip())] = value.strip() for key in ('conf', 'debug', 'verbose', 'prompt_all', 'interactive', - 'fallback', 'delegate', 'skip_version_check'): + 'fallback', 'delegate'): value = getattr(options, key, None) if value is not None: overrides[key] = value |