Bug 798084

Summary: Python client does not show helpful error when missing project id for 'project info' command
Product: [Retired] Zanata Reporter: David Mason <damason>
Component: Component-PythonClientAssignee: James Ni <jni>
Status: CLOSED NEXTRELEASE QA Contact: Joyce Chang <jochang>
Severity: low Docs Contact:
Priority: low    
Version: 1.5-SNAPSHOTCC: jni, petersen, zanata-bugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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