zanata-cli push ignores zanata.ini
Description
Environment
Activity
Jeremy Bailey 4 January 2019 at 14:32
I learned that one other cause of this problem is if you have your zanata.ini
file UTF-8 encoded with a BOM. Zanata-CLI doesn’t seem to know how to deal with the BOM, so changing the encoding to remove the BOM can fix the problem.
Former user 20 April 2018 at 07:24Edited
I still think it is worth adding a hint for this error, it's very easy to add and it makes debugging the problem so much easier.
Former user 20 April 2018 at 00:24
We are closing all the old issues to have more clarity in our backlog for Zanata project. Feel free to re-open or leave a comment if you require our attention on your Jira.
Former user 25 April 2017 at 21:32
Thanks for the feedback . The zanata-cli was indeed designed to look up to the matched url in zanata.ini.
It is recommended to copy and paste the zanata.ini config from your configuration page in Zanata to prevent such mistake.
http://docs.zanata.org/en/release/client/configuration/#user-configuration
Former user 25 April 2017 at 07:42
A hint to check if the url of the xml matches exactly any of the ini urls would be lovely. Just spent an hour trying to find out what the problem was.
Details
Details
Assignee
Reporter
Labels
Components
Priority

Description of problem:
zanata-cli requires the username and API key to be specified via command-line options even though they are specified in the zanata.ini file. The ini file has been used successfully with other commands.
Version-Release number of selected component (if applicable):
3.6.0
Actual results:
$ zanata-cli -e push
[INFO] Loading project config from zanata.xml
[INFO] Loading user config from /home/user/.config/zanata.ini
[INFO] Error stacktraces are turned on.
[ERROR] Execution failed:
org.zanata.client.exceptions.ConfigException: Username must be specified
at org.zanata.client.commands.OptionsUtil.checkMandatoryOptsForRequestFactory(OptionsUtil.java:293)
at org.zanata.client.commands.OptionsUtil.createRequestFactory(OptionsUtil.java:277)
at org.zanata.client.commands.PushPullCommand.<init>(PushPullCommand.java:95)
at org.zanata.client.commands.push.PushCommand.<init>(PushCommand.java:89)
at org.zanata.client.commands.push.PushOptionsImpl.initCommand(PushOptionsImpl.java:67)
at org.zanata.client.commands.ArgsUtil.runCommand(ArgsUtil.java:47)
at org.zanata.client.ZanataClient.processArgs(ZanataClient.java:170)
at org.zanata.client.ZanataClient.main(ZanataClient.java:95)
$ zanata-cli -e push --username username
[INFO] Loading project config from zanata.xml
[INFO] Loading user config from /home/user/.config/zanata.ini
[INFO] Error stacktraces are turned on.
[ERROR] Execution failed:
org.zanata.client.exceptions.ConfigException: API key must be specified
at org.zanata.client.commands.OptionsUtil.checkMandatoryOptsForRequestFactory(OptionsUtil.java:296)
at org.zanata.client.commands.OptionsUtil.createRequestFactory(OptionsUtil.java:277)
at org.zanata.client.commands.PushPullCommand.<init>(PushPullCommand.java:95)
at org.zanata.client.commands.push.PushCommand.<init>(PushCommand.java:89)
at org.zanata.client.commands.push.PushOptionsImpl.initCommand(PushOptionsImpl.java:67)
at org.zanata.client.commands.ArgsUtil.runCommand(ArgsUtil.java:47)
at org.zanata.client.ZanataClient.processArgs(ZanataClient.java:170)
at org.zanata.client.ZanataClient.main(ZanataClient.java:95)
Running the push with both the key and the username works.
Expected results:
The zanata.ini file should be used so that we don't need to supply the username and key again on the command line.