#6115 ipa command provides stack trace when provided with single hypen commands
Closed: fixed by rcritten. Opened by mbasti.

Ticket was cloned from Red Hat Bugzilla (product Red Hat Enterprise Linux 7): Bug 1357495

Description of problem:
If user provides commands such as following, then ipa command provides stack
trace instead of error message to user.
# ipa -verbose
Traceback (most recent call last):
  File "/usr/bin/ipa", line 32, in <module>
    cli.run(api)
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 1346, in run
    api.log.exception('%s: %s', e.__class__.__name__, str(e))
AttributeError: 'API' object has no attribute 'log'
# ipa -ver
Traceback (most recent call last):
  File "/usr/bin/ipa", line 32, in <module>
    cli.run(api)
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 1346, in run
    api.log.exception('%s: %s', e.__class__.__name__, str(e))
AttributeError: 'API' object has no attribute 'log'
# ipa -e aa
Traceback (most recent call last):
  File "/usr/bin/ipa", line 32, in <module>
    cli.run(api)
  File "/usr/lib/python2.7/site-packages/ipalib/cli.py", line 1346, in run
    api.log.exception('%s: %s', e.__class__.__name__, str(e))
AttributeError: 'API' object has no attribute 'log'
Version-Release number of selected component (if applicable):
ipa-server-4.2.0-15.el7_2.17.x86_64
How reproducible:
100%
Steps to Reproduce:
1. ipa -verbose # or
2. ipa -e aa # or
3. ipa -ver
Actual results:
IPA command provides stack traces
Expected results:
IPA command should provide user friendly information about unknown command

Metadata Update from @mbasti:
- Issue assigned to someone
- Issue set to the milestone: FreeIPA 4.5 backlog

Metadata Update from @rcritten:
- Issue assigned to rcritten (was: someone)
- Issue close_status updated to: None
- Issue set to the milestone: None (was: FreeIPA 4.5 backlog)

https://github.com/freeipa/freeipa/pull/5063

master:

  • 4a89da5352314cad4417ee42eac2cd8ad7cdc057 ipatests: Add option/arg parsing tests for the cli
  • 12dfb0fc96ad6db3aa2cd5a56b6cbc8cd092751a cli: When parsing options require name/value pairs

ipa-4-8:

  • 6f4f7c616628a6200f7d3b56969d6e6204d3aea5 ipatests: Add option/arg parsing tests for the cli
  • dce5b1c854382058c62cb7c7155edf715088ca0a cli: When parsing options require name/value pairs

Metadata Update from @rcritten:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata