483b06
From b16661f4dab141ef692ed6c893c0cb05566b64ec Mon Sep 17 00:00:00 2001
483b06
From: David Kupka <dkupka@redhat.com>
483b06
Date: Fri, 12 May 2017 17:17:05 +0200
483b06
Subject: [PATCH] otptoken-add-yubikey: When --digits not provided use default
483b06
 value
483b06
483b06
Since Thin client was introduced default values for options are not populated
483b06
in client side plugins. When option has default value and is needed in client
483b06
plugin it must be handled by explicitly.
483b06
483b06
https://pagure.io/freeipa/issue/6900
483b06
483b06
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
483b06
---
483b06
 ipaclient/plugins/otptoken_yubikey.py | 5 ++++-
483b06
 1 file changed, 4 insertions(+), 1 deletion(-)
483b06
483b06
diff --git a/ipaclient/plugins/otptoken_yubikey.py b/ipaclient/plugins/otptoken_yubikey.py
483b06
index 759b7226819f0fa693e475b25262b5d93ac2d39f..9e0e98996ca2d34f34f61c9c07088a3f544ad166 100644
483b06
--- a/ipaclient/plugins/otptoken_yubikey.py
483b06
+++ b/ipaclient/plugins/otptoken_yubikey.py
483b06
@@ -142,7 +142,10 @@ class otptoken_add_yubikey(Command):
483b06
 
483b06
         # Write the config.
483b06
         cfg = yk.init_config()
483b06
-        cfg.mode_oath_hotp(key, kwargs['ipatokenotpdigits'])
483b06
+        cfg.mode_oath_hotp(key, kwargs.get(
483b06
+            'ipatokenotpdigits',
483b06
+            self.get_default_of('ipatokenotpdigits')
483b06
+        ))
483b06
         cfg.extended_flag('SERIAL_API_VISIBLE', True)
483b06
         yk.write_config(cfg, slot=kwargs['slot'])
483b06
 
483b06
-- 
483b06
2.9.3
483b06