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