progrium / ginkgo

Python service microframework
http://ginkgo.readthedocs.org
MIT License
325 stars 48 forks source link

ginkgo should return 0 when it fails #13

Closed objcode closed 12 years ago

objcode commented 13 years ago

When gservice starts up it incorrectly returns a 0 return code for the following error cases:

  1. Logging permissions aren't met, and log file can't be opened
  2. gevent cannot be imported due to libevent configuration error
  3. PIDfile can't be locked.

I've included the traceback for issue #3 below.

Traceback (most recent call last): File "/usr/local/python/bin/gservice", line 8, in load_entry_point('gservice==0.2.0', 'console_scripts', 'gservice')() File "/usr/local/python/lib/python2.7/site-packages/gservice-0.2.0-py2.7.egg/gservice/runner.py", line 22, in main Runner().do_action() File "/usr/local/python/lib/python2.7/site-packages/gservice-0.2.0-py2.7.egg/gservice/runner.py", line 255, in do_action getattr(self, func)(_args, _kwargs) File "/usr/local/python/lib/python2.7/site-packages/gservice-0.2.0-py2.7.egg/gservice/runner.py", line 247, in _start super(Runner, self)._start() File "/usr/local/python/lib/python2.7/site-packages/python_daemon-1.6-py2.7.egg/daemon/runner.py", line 124, in _start self.daemon_context.open() File "/usr/local/python/lib/python2.7/site-packages/python_daemon-1.6-py2.7.egg/daemon/daemon.py", line 346, in open self.pidfile.enter() File "build/bdist.linux-i686/egg/lockfile/init.py", line 226, in enter File "/usr/local/python/lib/python2.7/site-packages/python_daemon-1.6-py2.7.egg/daemon/pidfile.py", line 42, in acquire super(TimeoutPIDLockFile, self).acquire(timeout, _args, _kwargs) File "build/bdist.linux-i686/egg/lockfile/pidlockfile.py", line 85, in acquire lockfile.LockTimeout

progrium commented 12 years ago

RuntimeErrors will cause it to error using argparse, which will exit non-zero.