zend-patterns / ZendServerSDK

Pure ZF2 CLI for zpk creation and webapi client.
BSD 3-Clause "New" or "Revised" License
22 stars 17 forks source link

listTargets when zsapi.ini is missing #96

Open zvikazend opened 7 years ago

zvikazend commented 7 years ago

API automation should get a message and not exception, in order to parse and continue the flow. With no zsapi.ini, we get an exception instead of something like: ini files does not exist, or no targets found.

Error

$ zs-client.sh listTargets
Name           |            URL
--------------------------------
local => http://127.0.0.1:10081
$ rm /home/zvika/.zsapi.ini
$ zs-client.sh listTargets
======================================================================
   The application has thrown an exception!
======================================================================
 Zend\Config\Exception\RuntimeException
 File '/home/zvika/.zsapi.ini' doesn't exist or not readable

Manual fix

Do touch .zsapi.ini, command returns output with no records.

$ touch /home/zvika/.zsapi.ini
$ zs-client.sh listTargets
Name           |            URL
--------------------------------

Sort of an extension to issue #76 Thanks!