Skip to content
Snippets Groups Projects
Commit b6f16a32 authored by Release Webservice's avatar Release Webservice
Browse files

Finished release 0.28.

parents 1bfe3d8c 4f629bf4
No related branches found
No related tags found
No related merge requests found
......@@ -42,3 +42,4 @@
0.25: propagate errors when waiting for tasks to complete
0.26: NOT SUITABLE FOR PRODUCTION! filter qfx* routers until space is synced with opsdb
0.27: added some status flags to the latch structure
0.28: added latch to version response
import pkg_resources
from flask import Blueprint, jsonify
from flask import Blueprint, jsonify, current_app
from inventory_provider.routes import common
from inventory_provider.tasks.common import get_current_redis, get_latch
routes = Blueprint("inventory-data-default-routes", __name__)
......@@ -16,8 +17,13 @@ def after_request(resp):
@routes.route("/version", methods=['GET', 'POST'])
@common.require_accepts_json
def version():
return jsonify({
config = current_app.config["INVENTORY_PROVIDER_CONFIG"]
version_params = {
'api': API_VERSION,
'module':
pkg_resources.get_distribution('inventory_provider').version
})
}
latch = get_latch(get_current_redis(config))
if latch:
version_params['latch'] = latch
return jsonify(version_params)
......@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name='inventory-provider',
version="0.27",
version="0.28",
author='GEANT',
author_email='swd@geant.org',
description='Dashboard inventory provider',
......
......@@ -79,7 +79,9 @@ class MockedRedis(object):
MockedRedis.db['db:latch'] = json.dumps({
'current': 0,
'next': 0,
'this': 0
'this': 0,
'pending': False,
'failure': False
})
def set(self, name, value):
......
......@@ -7,9 +7,26 @@ DEFAULT_REQUEST_HEADERS = {
}
def test_version_request(client):
def test_version_request(client, mocked_redis):
version_schema = {
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"latch": {
"type": "object",
"properties": {
"current": {"type": "integer"},
"next": {"type": "integer"},
"this": {"type": "integer"},
"failure": {"type": "boolean"},
"pending": {"type": "boolean"},
},
"required": ["current", "next", "this", "pending", "failure"],
"additionalProperties": False
}
},
"type": "object",
"properties": {
"api": {
......@@ -19,7 +36,8 @@ def test_version_request(client):
"module": {
"type": "string",
"pattern": r'\d+\.\d+'
}
},
"latch": {"$ref": "#/definitions/latch"}
},
"required": ["api", "module"],
"additionalProperties": False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment