zuul-server learned --version

I have so many Zuul installation that I somehow loose track of their
version. I am forced to look at the zuul-server wrapper script to figure
out the current version when I could just ask the might zuul-server to
give me its version straight from the command line.

Example:

 $ zuul-server --version
 Zuul version: 1.1.0.45.g70c7158

Since we might not have a valid zuul.conf passed, the version display
must happen before  server.read_config() or we end up with a stracktrace
on a fresh installation.

Change-Id: I284de8da5af6678c7aaa1b17c950390e135f6e89
Reviewed-on: https://review.openstack.org/25007
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Elizabeth Krumbach <lyz@princessleia.com>
Approved: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Tested-by: Jenkins
This commit is contained in:
Antoine Musso 2013-03-21 16:31:40 +01:00 committed by Jenkins
parent 70c715813c
commit 26b1fb81bd
1 changed files with 8 additions and 0 deletions

View File

@ -47,6 +47,8 @@ class Server(object):
help='do not run as a daemon')
parser.add_argument('-t', dest='validate', action='store_true',
help='validate layout file syntax')
parser.add_argument('--version', dest='version', action='store_true',
help='show zuul version')
self.args = parser.parse_args()
def read_config(self):
@ -123,6 +125,12 @@ class Server(object):
def main():
server = Server()
server.parse_arguments()
if server.args.version:
from zuul.version import version_info as zuul_version_info
print "Zuul version: %s" % zuul_version_info.version_string()
sys.exit(0)
server.read_config()
if server.args.layout: