URL: https://github.com/freeipa/freeipa/pull/785
Author: dkupka
 Title: #785: otptoken-add-yubikey: When --digits not provided use default value
Action: opened

PR body:
"""
Since Thin client was introduced default values for options are not populated
in client side plugins. When option has default value and is needed in client
plugin it must be handled by explicitly.

https://pagure.io/freeipa/issue/6900
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/785/head:pr785
git checkout pr785
From 0e07bce2d1d57713816821235c9a2b3a9c270e4c Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Fri, 12 May 2017 17:17:05 +0200
Subject: [PATCH] otptoken-add-yubikey: When --digits not provided use default
 value

Since Thin client was introduced default values for options are not populated
in client side plugins. When option has default value and is needed in client
plugin it must be handled by explicitly.

https://pagure.io/freeipa/issue/6900
---
 ipaclient/plugins/otptoken_yubikey.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ipaclient/plugins/otptoken_yubikey.py b/ipaclient/plugins/otptoken_yubikey.py
index 9993ec8..60b73a7 100644
--- a/ipaclient/plugins/otptoken_yubikey.py
+++ b/ipaclient/plugins/otptoken_yubikey.py
@@ -147,7 +147,10 @@ def forward(self, *args, **kwargs):
 
         # Write the config.
         cfg = yk.init_config()
-        cfg.mode_oath_hotp(key, kwargs['ipatokenotpdigits'])
+        cfg.mode_oath_hotp(key, kwargs.get(
+            'ipatokenotpdigits',
+            self.get_default_of('ipatokenotpdigits')
+        ))
         cfg.extended_flag('SERIAL_API_VISIBLE', True)
         yk.write_config(cfg, slot=kwargs['slot'])
 
-- 
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

Reply via email to