2

I am looking to add fields into the user definition in FreeIPA 4.4.

Right now I have modified the user schema and added the fields in the Web UI for editions.

Now I would like to be able to change the new fields added (country code c and country name co) via the JSON API and thus via the CLI tool. This will require to changes already existing API call such as user_add, user_show etc.

I have found examples of such plugins but for FreeIPA 3, and it seems that the python API changed since then because those are not working when I adapt those with the good field name. I get the following error:

$ ipa
ipa: ERROR: ImportError: No module named plugins
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 1348, in run
    api.finalize()
  File "/usr/lib/python2.7/site-packages/ipalib/plugable.py", line 707, in finalize
    self.__do_if_not_done('load_plugins')
  File "/usr/lib/python2.7/site-packages/ipalib/plugable.py", line 422, in __do_if_not_done
    getattr(self, name)()
  File "/usr/lib/python2.7/site-packages/ipalib/plugable.py", line 586, in load_plugins
self.add_package(package)
  File "/usr/lib/python2.7/site-packages/ipalib/plugable.py", line 613, in add_package
    module = importlib.import_module(name)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/lib/python2.7/site-packages/ipaclient/plugins/country.py", line 1, in <module>
    from ipalib.plugins import user
ImportError: No module named plugins
ipa: ERROR: an internal error has occurred

Is there a minimal example somewhere online of adding one or two new attributes to a user for FreeIPA 4.4?

Small precision, I know at least one example of full-blown plugin that adds a whole new type of object, but as far as I get everything in there, it is not applicable in the case of adding new fields for an already existing object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.