Bug 798084 - Python client does not show helpful error when missing project id for 'project info' command
Summary: Python client does not show helpful error when missing project id for 'projec...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-PythonClient
Version: 1.5-SNAPSHOT
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: ---
Assignee: James Ni
QA Contact: Joyce Chang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-28 02:00 UTC by David Mason
Modified: 2013-03-04 03:19 UTC (History)
3 users (show)

Fixed In Version: 1.3.5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-26 08:13:47 UTC


Attachments (Terms of Use)

Description David Mason 2012-02-28 02:00:58 UTC
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-30 03:17:35 UTC
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 05:25:53 UTC
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 23:56:52 UTC
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.