[Freeipa-devel] [freeipa PR#182][comment] Use env var IPA_CONFDIR to get confdir for 'cli' context

tomaskrizek freeipa-github-notification at redhat.com
Mon Nov 7 14:48:49 UTC 2016


  URL: https://github.com/freeipa/freeipa/pull/182
Title: #182: Use env var IPA_CONFDIR to get confdir for 'cli' context

tomaskrizek commented:
"""
I also think `IPA_CONFDIR` environment variable is the proper way to configure the config directory with use cases such as Ansible.

However, with the current solution, if the `AttributeError` is raised, the command will fail and show a traceback. I'd really prefer to only see the error message itself. Perhaps this could be solved by using `ScriptError`?

```
# IPA_CONFDIR=/root/ipa ipa ping
[2016-11-07T14:38:11Z ipa] <ERROR>: AttributeError: IPA_CONFDIR must be an absolute path to an existing directory.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 1345, in run
    (_options, argv) = api.bootstrap_with_global_options(context='cli')
  File "/usr/lib/python2.7/site-packages/ipalib/plugable.py", line 580, in bootstrap_with_global_options
    self.bootstrap(parser, **overrides)
  File "/usr/lib/python2.7/site-packages/ipalib/plugable.py", line 436, in bootstrap
    self.env._bootstrap(**overrides)
  File "/usr/lib/python2.7/site-packages/ipalib/config.py", line 469, in _bootstrap
    'IPA_CONFDIR must be an absolute path to an '
AttributeError: IPA_CONFDIR must be an absolute path to an existing directory.
[2016-11-07T14:38:11Z ipa] <ERROR>: an internal error has occurred
```
"""

See the full comment at https://github.com/freeipa/freeipa/pull/182#issuecomment-258855038


More information about the Freeipa-devel mailing list