[openstack-dev] [nova] Standardized executable return codes/logging conventions?

Finucane, Stephen stephen.finucane at intel.com
Tue Mar 8 11:16:53 UTC 2016


I'm working on a fix [1] for bug #1538227, "Failed `nova-manage db
sync` returns exitcode of 0" [2]. Having done this, I've noted that
there seems to be no consistent policy around (a) what return codes to
use (if any), and (b) whether to use logging or printing. Are there
any guidelines on this in Nova (or any OpenStack project, for that
matter) and, if not, do we need some? This is important for me as I'm
adding a new return code to said executable and I've been asked for
provide some rationale for my choice of code [3]

FWIW, I think the returns codes don't matter so much so long as they
always return non-zero for failed/error cases and don't change (without
good reason) once they do so. I also think output should be done via
print, per the recommendations of the Python documentation [4], but
some consitency in output would be appreciated.

Cheers,
Stephen

[1] https://review.openstack.org/#/c/289308/2
[2] https://bugs.launchpad.net/nova/+bug/1538227
[3] https://review.openstack.org/#/c/289308/2/nova/cmd/manage.py
[4] https://docs.python.org/3.3/howto/logging.html#when-to-use-logging



More information about the OpenStack-dev mailing list