Bug 738514 - zanata push fails with JSON error
zanata push fails with JSON error
Status: CLOSED NEXTRELEASE
Product: Zanata
Classification: Community
Component: Component-PythonClient (Show other bugs)
1.3
Unspecified Linux
unspecified Severity medium
: ---
: ---
Assigned To: Runa Bhattacharjee
Ding-Yi Chen
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-14 23:51 EDT by Joshua Wulf
Modified: 2014-10-19 18:59 EDT (History)
5 users (show)

See Also:
Fixed In Version: 1.3.0-23-gab314ce
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-10-28 03:25:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Joshua Wulf 2011-09-14 23:51:42 EDT
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1

zanata 1.3.1 on F15.

Reproducible: Always

Steps to Reproduce:
1.Run zanata publican push
2.
3.
Actual Results:  
[jwulf@gaura Zanata_Translator_Quickstart]$ zanata push --project-type=publican
Loading zanata project config from: /home/jwulf/Work/Zanata/Zanata_Translator_Quickstart/zanata.xml
Loading zanata user config from: /home/jwulf/.config/zanata.ini
zanata server: 
http://zanata-endeavour.lab.eng.bne.redhat.com:8080/

Traceback (most recent call last):
  File "/usr/bin/zanata", line 25, in <module>
    zanata.run()
  File "/usr/lib/python2.7/site-packages/zanataclient/zanata.py", line 1223, in run
    program_name=os.path.split(sys.argv[0])[1],
  File "/usr/lib/python2.7/site-packages/zanataclient/command.py", line 325, in handle_program
    command(command_options, args)
  File "/usr/lib/python2.7/site-packages/zanataclient/zanata.py", line 1018, in push
    get_version(url)
  File "/usr/lib/python2.7/site-packages/zanataclient/zanata.py", line 371, in get_version
    content = version.get_server_version()
  File "/usr/lib/python2.7/site-packages/zanataclient/zanatalib/versionservice.py", line 45, in get_server_version
    version = json.loads(content)
  File "/usr/lib64/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/json/decoder.py", line 360, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/decoder.py", line 378, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded


Expected Results:  
Zanata should push project to the server.

When the username / apikey pair is incorrect, the following occurs:


[jwulf@gaura Zanata_Translator_Quickstart]$ zanata publican push
Loading zanata project config from: /home/jwulf/Work/Zanata/Zanata_Translator_Quickstart/zanata.xml
Loading zanata user config from: /home/jwulf/.config/zanata.ini
zanata server: 
http://zanata-endeavour.lab.eng.bne.redhat.com:8080

zanata python client version: 1.3.0, zanata server API version: 1.4-SNAPSHOT
error: Please specify username and apikey in zanata.ini or with '--username' and '--apikey' options


Note that the server version is correctly reported here. The error message produced when the apikey / username pair is correct suggests that retrieving the server version is the cause of the error.
Comment 1 Joshua Wulf 2011-09-15 00:11:25 EDT
Also zanata-python-client-1.3.0-1.fc15.noarch on F15
Comment 2 James Ni 2011-09-29 03:54:30 EDT
This bug is due to the '\n' or white space in URL, i have modify the source on upstream to trim the URL. Also, it is better to check the <url> tag in zanata.xml and make sure that URL doesn't include new line.
Comment 3 Ding-Yi Chen 2011-10-03 21:01:03 EDT
James,

It looks like the data is invalid, did you change your source code to handle this by display error messages or try to remove the white space?

If not, please close it as NOTABUG instead.
Comment 4 James Ni 2011-10-10 00:31:29 EDT
Hi Ding

Yes, I have modified the source code to handle this by removing the white space or '\n', also giving a warning messages if URL contains white space or '\n'
Comment 5 Ding-Yi Chen 2011-10-11 20:49:19 EDT
VERIFIED with commit ab314cee446132875151823aaf9807c18c564ac2

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