Hi, the attached patch fixes <https://fedorahosted.org/freeipa/ticket/6174>.
Honza -- Jan Cholasta
From 9756b9d426b09e38d1ecbdb1e84ec8f5b0f9a957 Mon Sep 17 00:00:00 2001 From: Jan Cholasta <jchol...@redhat.com> Date: Mon, 8 Aug 2016 13:09:39 +0200 Subject: [PATCH] parameters: move the `confirm` kwarg to Param Whether a parameter is treated like password is determined by the `password` class attribute defined in the Param class. Whether the CLI will asks for confirmation of a password parameter depends on the value of the `confirm` kwarg of the Password class. Move the `confirm` kwarg from the Password class to the Param class, so that it can be used by any Param subclass which has the `password` class attribute set to True. This fixes confirmation of the --key option of otptoken-add, which is a Bytes subclass with `password` set to True. https://fedorahosted.org/freeipa/ticket/6174 --- ipaclient/remote_plugins/schema.py | 2 +- ipalib/parameters.py | 5 +---- ipaserver/plugins/otptoken.py | 4 ---- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/ipaclient/remote_plugins/schema.py b/ipaclient/remote_plugins/schema.py index a215452..c06d6d2 100644 --- a/ipaclient/remote_plugins/schema.py +++ b/ipaclient/remote_plugins/schema.py @@ -167,7 +167,7 @@ class _SchemaPlugin(object): elif key in ('cli_metavar', 'cli_name'): kwargs[key] = str(value) - elif key == 'confirm' and issubclass(cls, Password): + elif key == 'confirm': kwargs[key] = value elif key == 'default': default = value diff --git a/ipalib/parameters.py b/ipalib/parameters.py index 1581b7d..b2e0434 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -418,6 +418,7 @@ class Param(ReadOnly): ('cli_metavar', str, None), ('no_convert', bool, False), ('deprecated', bool, False), + ('confirm', bool, True), # The 'default' kwarg gets appended in Param.__init__(): # ('default', self.type, None), @@ -1511,10 +1512,6 @@ class Password(Str): password = True - kwargs = Str.kwargs + ( - ('confirm', bool, True), - ) - def _convert_scalar(self, value, index=None): if isinstance(value, (tuple, list)) and len(value) == 2: (p1, p2) = value diff --git a/ipaserver/plugins/otptoken.py b/ipaserver/plugins/otptoken.py index 56b8c91..39012e2 100644 --- a/ipaserver/plugins/otptoken.py +++ b/ipaserver/plugins/otptoken.py @@ -79,10 +79,6 @@ class OTPTokenKey(Bytes): password = True - kwargs = Bytes.kwargs + ( - ('confirm', bool, True), - ) - def _convert_scalar(self, value, index=None): if isinstance(value, (tuple, list)) and len(value) == 2: (p1, p2) = value -- 2.7.4
-- 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