Bug 798084 - Python client does not show helpful error when missing project id for 'project info' command
Python client does not show helpful error when missing project id for 'projec...
Status: CLOSED NEXTRELEASE
Product: Zanata
Classification: Community
Component: Component-PythonClient (Show other bugs)
1.5-SNAPSHOT
Unspecified Unspecified
low Severity low
: ---
: ---
Assigned To: James Ni
Joyce Chang
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-27 21:00 EST by David Mason
Modified: 2013-03-03 22:19 EST (History)
3 users (show)

See Also:
Fixed In Version: 1.3.5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-26 04:13:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Mason 2012-02-27 21:00:58 EST
Description of problem:
When running "zanata project info" without specifying a project id, a stack trace is shown instead of a helpful error message.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.run "zanata project info" with a valid zanata url and with no zanata.xml present.
  
Actual results:
Can not find zanata.xml, please specify the path of zanata.xml
Overriding url of server with command line option
zanata python client version: 1.3.3-25-g7cff, zanata server API version: 1.5.0-alpha-3-SNAPSHOT
Traceback (most recent call last):
  File "/home/damason/NotBackedUp/zanata-python-client/zanata", line 27, in <module>
    zanata.run()
  File "/NotBackedUp/damason/zanata-python-client/zanataclient/zanata.py", line 1369, in run
    program_name=os.path.split(sys.argv[0])[1],
  File "/NotBackedUp/damason/zanata-python-client/zanataclient/command.py", line 339, in handle_program
    command(command_options, args)
  File "/NotBackedUp/damason/zanata-python-client/zanataclient/zanata.py", line 630, in project_info
    project_id = project_config['project_id']
KeyError: 'project_id'


Expected results:
Can not find zanata.xml, please specify the path of zanata.xml
Overriding url of server with command line option
zanata python client version: 1.3.3-25-g7cff, zanata server API version: 1.5.0-alpha-3-SNAPSHOT
Error: please specify a project with --project-id


Additional info:
Comment 1 James Ni 2012-03-29 23:17:35 EDT
Thanks David, 

I have modified the python client to fix this issue, please check
https://github.com/zanata/zanata-python-client/commit/ff6dadf1cb476e3a262c4bec98ab6dba5d94e564
Comment 2 Joyce Chang 2012-04-03 01:25:53 EDT
verified with zanata python client version: 1.3.4-12-gff6d & zanata server API version: 1.5.1-SNAPSHOT
Comment 3 Joyce Chang 2012-04-03 19:56:52 EDT
added verification testing process:
Setup:
zanata python client version: 1.3.4-12-gff6d  installed 

steps:
1. open a terminal where zanata python client vesion: 1.3.4-12-gff6d is installed
 
2.issue command:  ./zanata project info --url=http://zanata-esperance.lab.eng.bne.redhat.com:8080/


Expected results:
Can not find zanata.xml, please specify the path of zanata.xml
Overriding url of server with command line option
zanata python client version: 1.3.3-25-g7cff, zanata server API version:
1.5.0-alpha-3-SNAPSHOT
Error: please specify a project with --project-id

Actual results:
Can not find zanata.xml, please specify the path of zanata.xml
Overriding url of server with command line option
zanata python client version: 1.3.4-12-gff6d, zanata server API version: 1.5.1-SNAPSHOT
error: 
Please use zanata project info --project-id=project_id or zanata.xml to specify the project id

Note You need to log in before you can comment on or make changes to this bug.