commit sha added

This commit is contained in:
Nikolay Markov
2013-01-25 13:55:22 +04:00
committed by default
parent b64d724b51
commit 8fbc9d6615
6 changed files with 29 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
import os
import web
import json
from git import Repo
from nailgun.settings import settings
from nailgun.api.handlers.base import JSONHandler
class VersionHandler(JSONHandler):
def GET(self):
web.header('Content-Type', 'application/json')
return json.dumps({
"sha": str(settings.COMMIT_SHA or "Unknown")
})

View File

@@ -26,6 +26,8 @@ from nailgun.api.handlers.logs import LogEntryCollectionHandler
from nailgun.api.handlers.logs import LogSourceCollectionHandler
from nailgun.api.handlers.logs import LogSourceByNodeCollectionHandler
from nailgun.api.handlers.version import VersionHandler
urls = (
r'/releases/?$',
'ReleaseCollectionHandler',
@@ -63,6 +65,8 @@ urls = (
'LogSourceCollectionHandler',
r'/logs/sources/nodes/(?P<node_id>\d+)/?$',
'LogSourceByNodeCollectionHandler',
r'/version/?$',
'VersionHandler'
)
api_app = web.application(urls, locals())

View File

@@ -214,3 +214,5 @@ DNS_SEARCH: "example.com"
FAKE_TASKS_TICK_INTERVAL: "1"
FAKE_TASKS_TICK_COUNT: "30"
COMMIT_SHA: ""

View File

@@ -41,6 +41,7 @@ class nailgun::venv(
$database_port = "3306"
$database_user = "nailgun"
$database_passwd = "nailgun"
$commit_sha = ""
file { "/etc/nailgun":
ensure => directory,

View File

@@ -59,3 +59,5 @@ PUPPET_VERSION: "2.7.19"
DNS_DOMAIN: "<%= domain %>"
DNS_SERVERS: "<%= scope.lookupvar('nailgun::puppet_master_ip') %>"
DNS_SEARCH: "<%= domain %>"
COMMIT_SHA: "<%= commit_sha %>"

View File

@@ -16,4 +16,4 @@ pycrypto 2.6
simplejson 2.6.2
web.py 0.37
wsgilog 0.3
wsgiref 0.1.2
wsgiref 0.1.2