summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorMartin Babinsky <mbabinsk@redhat.com>2015-07-03 12:21:09 +0200
committerTomas Babej <tbabej@redhat.com>2015-07-08 00:35:05 +0200
commitea7f392bb98c1f1c4558ec5d6e84ee7a7c613474 (patch)
tree77d8a5f0b0737f97a364265dd15d190838b15347 /ipalib
parent1d9bdb240943527e1e19704acd183eae254267ae (diff)
downloadfreeipa-ea7f392bb98c1f1c4558ec5d6e84ee7a7c613474.tar.gz
freeipa-ea7f392bb98c1f1c4558ec5d6e84ee7a7c613474.tar.xz
freeipa-ea7f392bb98c1f1c4558ec5d6e84ee7a7c613474.zip
add option to skip client API version check
This can be either set in IPA config file or specified as 'ipa --skip-version-check [COMMAND]'. part of https://fedorahosted.org/freeipa/ticket/4768 Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/cli.py1
-rw-r--r--ipalib/constants.py4
-rw-r--r--ipalib/frontend.py4
-rw-r--r--ipalib/plugable.py8
4 files changed, 13 insertions, 4 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 8515b91ed..b260ca651 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -1082,7 +1082,6 @@ class cli(backend.Executioner):
else:
for callback in callbacks:
callback(cmd, kw)
- kw['version'] = API_VERSION
self.load_files(cmd, kw)
return kw
diff --git a/ipalib/constants.py b/ipalib/constants.py
index fac937b5d..1509151ba 100644
--- a/ipalib/constants.py
+++ b/ipalib/constants.py
@@ -188,6 +188,10 @@ DEFAULT_CONFIG = (
# Used when verifying that the API hasn't changed. Not for production.
('validate_api', False),
+ # Skip client vs. server API version checking. Can lead to errors/strange
+ # behavior when newer clients talk to older servers. Use with caution.
+ ('skip_version_check', False),
+
# ********************************************************
# The remaining keys are never set from the values here!
# ********************************************************
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index 81bf6d90b..3a59838d7 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -423,7 +423,7 @@ class Command(HasParam):
version_provided = 'version' in options
if version_provided:
self.verify_client_version(unicode(options['version']))
- else:
+ elif self.api.env.in_server or not self.api.env.skip_version_check:
options['version'] = API_VERSION
params = self.args_options_2_params(*args, **options)
self.debug(
@@ -451,7 +451,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['version'])
+ self.validate_output(ret, options.get('version', API_VERSION))
return ret
def soft_validate(self, values):
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 2ce7acfd6..269d58092 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -484,6 +484,12 @@ 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
@@ -503,7 +509,7 @@ class API(ReadOnly):
pass
overrides[str(key.strip())] = value.strip()
for key in ('conf', 'debug', 'verbose', 'prompt_all', 'interactive',
- 'fallback', 'delegate'):
+ 'fallback', 'delegate', 'skip_version_check'):
value = getattr(options, key, None)
if value is not None:
overrides[key] = value