URL: https://github.com/freeipa/freeipa/pull/313 Author: dkupka Title: #313: ipaclient.plugins: Use api_version from internally called commands Action: synchronized
To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/313/head:pr313 git checkout pr313
From ce8e8a5de53a2bfdbeb21985682d74a7da4c4670 Mon Sep 17 00:00:00 2001 From: David Kupka <dku...@redhat.com> Date: Tue, 6 Dec 2016 12:35:23 +0100 Subject: [PATCH] ipaclient.plugins: Use api_version from internally called commands In client plugins make sure the api_version is 'inherited' from server command that is internally called. Otherwise the api_version is obtained from client API instance. When calling server command from client command 'version' is passed in options and it overrides the right one. Server then refuses to handle such call. https://fedorahosted.org/freeipa/ticket/6539 --- ipaclient/plugins/automount.py | 4 ++++ ipaclient/plugins/otptoken_yubikey.py | 4 ++++ ipaclient/plugins/vault.py | 16 ++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/ipaclient/plugins/automount.py b/ipaclient/plugins/automount.py index 540bd59..650c748 100644 --- a/ipaclient/plugins/automount.py +++ b/ipaclient/plugins/automount.py @@ -60,6 +60,10 @@ def __NO_CLI_getter(cls): NO_CLI = classproperty(__NO_CLI_getter) + @property + def api_version(self): + return self.api.Command.automountlocation_show.api_version + def output_for_cli(self, textui, result, *keys, **options): maps = result['result']['maps'] keys = result['result']['keys'] diff --git a/ipaclient/plugins/otptoken_yubikey.py b/ipaclient/plugins/otptoken_yubikey.py index 1075b6d..759b722 100644 --- a/ipaclient/plugins/otptoken_yubikey.py +++ b/ipaclient/plugins/otptoken_yubikey.py @@ -81,6 +81,10 @@ def __NO_CLI_getter(cls): NO_CLI = classproperty(__NO_CLI_getter) + @property + def api_version(self): + return self.api.Command.otptoken_add.api_version + def get_args(self): for arg in self.api.Command.otptoken_add.args(): yield arg diff --git a/ipaclient/plugins/vault.py b/ipaclient/plugins/vault.py index c099e9e..29157c7 100644 --- a/ipaclient/plugins/vault.py +++ b/ipaclient/plugins/vault.py @@ -209,6 +209,10 @@ def __NO_CLI_getter(cls): NO_CLI = classproperty(__NO_CLI_getter) + @property + def api_version(self): + return self.api.Command.vault_add_internal.api_version + def get_args(self): for arg in self.api.Command.vault_add_internal.args(): yield arg @@ -415,6 +419,10 @@ def __NO_CLI_getter(cls): NO_CLI = classproperty(__NO_CLI_getter) + @property + def api_version(self): + return self.api.Command.vault_mod_internal.api_version + def get_args(self): for arg in self.api.Command.vault_mod_internal.args(): yield arg @@ -602,6 +610,10 @@ def __NO_CLI_getter(cls): NO_CLI = classproperty(__NO_CLI_getter) + @property + def api_version(self): + return self.api.Command.vault_archive_internal.api_version + def get_args(self): for arg in self.api.Command.vault_archive_internal.args(): yield arg @@ -855,6 +867,10 @@ def __NO_CLI_getter(cls): NO_CLI = classproperty(__NO_CLI_getter) + @property + def api_version(self): + return self.api.Command.vault_retrieve_internal.api_version + def get_args(self): for arg in self.api.Command.vault_retrieve_internal.args(): yield arg
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code