[Freeipa-devel] [PATCH 0058] Add the otptoken-add-yubikey command

Jan Cholasta jcholast at redhat.com
Fri Jun 20 08:50:48 UTC 2014


Hi,

On 19.6.2014 22:30, Nathaniel McCallum wrote:
> This command behaves almost exactly like otptoken-add except:
> 1. The new token data is written directly to a YubiKey
> 2. The vendor/model/serial fields are populated from the YubiKey
>
> === NOTE ===
> 1. This patch depends on the new Fedora package: python-yubico. If you
> would like to help with the package review, please assign yourself here:
> https://bugzilla.redhat.com/show_bug.cgi?id=1111334
>
> 2. This patch doesn't actually work and I could use some help. The call
> to api.Command.otptoken_add() fails with:
> ipa: ERROR: non-public: AttributeError: no context.rpcclient in thread
> 'MainThread'
> Traceback (most recent call last):
>    File "/usr/lib/python2.7/site-packages/ipalib/backend.py", line 129,
> in execute
>      result = self.Command[_name](*args, **options)
>    File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 439,
> in __call__
>      ret = self.run(*args, **options)
>    File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 1118,
> in run
>      return self.forward(*args, **options)
>    File "/usr/lib/python2.7/site-packages/ipalib/plugins/otptoken.py",
> line 471, in forward
>      **options)
>    File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 439,
> in __call__
>      ret = self.run(*args, **options)
>    File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 755,
> in run
>      return self.forward(*args, **options)
>    File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 776,
> in forward
>      return self.Backend.rpcclient.forward(self.name, *args, **kw)
>    File "/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 874, in
> forward
>      command = getattr(self.conn, name)
>    File "/usr/lib/python2.7/site-packages/ipalib/backend.py", line 97, in
> __get_conn
>      self.id, threading.currentThread().getName())
> AttributeError: no context.rpcclient in thread 'MainThread'
> ipa: ERROR: an internal error has occurred
>

This happens because when you use frontend.Local, no connection to the 
server is created (see cli.run()). Instead of using frontend.Local and 
overriding forward(), use frontend.Command and override execute().

Honza

-- 
Jan Cholasta




More information about the Freeipa-devel mailing list