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

Finished release 0.32.

parents 12686de9 c496a1be
No related branches found
No related tags found
No related merge requests found
...@@ -45,4 +45,7 @@ ...@@ -45,4 +45,7 @@
0.28: added latch to version response 0.28: added latch to version response
0.29: DBOARD3-170 (don't return 404 for unrecognized peer addresses) 0.29: DBOARD3-170 (don't return 404 for unrecognized peer addresses)
removed filter on qfx* routers removed filter on qfx* routers
0.30: DBOARD3-173 No service name for critical alarm 0.30: DBOARD3-173 No service name for critical alarm
\ No newline at end of file 0.31: Added top-level-services to the related services
Fix canonicalization error of v6 addresses
0.32: Ensured all Related Services are returned for juniper links
\ No newline at end of file
...@@ -110,10 +110,10 @@ def get_juniper_link_info(source_equipment, interface): ...@@ -110,10 +110,10 @@ def get_juniper_link_info(source_equipment, interface):
} }
def _related_services(): def _related_services():
all_rs = []
for related in related_interfaces(source_equipment, interface): for related in related_interfaces(source_equipment, interface):
rs = r.get('opsdb:interface_services:%s:%s' rs = r.get('opsdb:interface_services:%s:%s'
% (source_equipment, related)) % (source_equipment, related))
all_rs = []
if rs: if rs:
for s in json.loads(rs.decode('utf-8')): for s in json.loads(rs.decode('utf-8')):
top_level_services.extend( top_level_services.extend(
...@@ -124,7 +124,7 @@ def get_juniper_link_info(source_equipment, interface): ...@@ -124,7 +124,7 @@ def get_juniper_link_info(source_equipment, interface):
'status': s['status'], 'status': s['status'],
'circuit_type': s['circuit_type'] 'circuit_type': s['circuit_type']
}) })
return all_rs return all_rs
related_services = _related_services() related_services = _related_services()
if related_services: if related_services:
......
from flask import Blueprint, current_app, jsonify from flask import Blueprint, current_app, jsonify, Response
from inventory_provider.tasks import worker from inventory_provider.tasks import worker
from inventory_provider.routes import common from inventory_provider.routes import common
from inventory_provider.tasks.common import get_current_redis, get_latch
routes = Blueprint("inventory-data-job-routes", __name__) routes = Blueprint("inventory-data-job-routes", __name__)
...@@ -13,6 +14,15 @@ def after_request(resp): ...@@ -13,6 +14,15 @@ def after_request(resp):
@routes.route("/update", methods=['GET', 'POST']) @routes.route("/update", methods=['GET', 'POST'])
@common.require_accepts_json @common.require_accepts_json
def update(): def update():
config = current_app.config['INVENTORY_PROVIDER_CONFIG']
latch = get_latch(get_current_redis(config))
if latch and latch['pending']:
return Response(
response='an update is already in progress',
status=503,
mimetype="text/html")
job_ids = worker.launch_refresh_cache_all( job_ids = worker.launch_refresh_cache_all(
current_app.config["INVENTORY_PROVIDER_CONFIG"]) current_app.config["INVENTORY_PROVIDER_CONFIG"])
return jsonify(job_ids) return jsonify(job_ids)
......
.grid-container {
display: grid;
}
.ok {
}
.error {
color: red;
font-weight: bold;
}
<!doctype html>
<html ng-app="inventoryApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.5/angular.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="update.js"></script>
<link rel="stylesheet" href="update.css">
</head>
<body>
<div ng-controller="update">
<div class="grid-container">
<div class="grid-item">
<button type="button"
class="btn btn-primary btn-lg"
ng-click="launch_update()"
ng-disabled="latch_pending">Update Inventory Provider</button>
</div>
<div class="grid-item" ng-class="latch_error||update_request_error ? 'error' : 'ok'">
{{ latch_info }}
</div>
<div class="grid-item" ng-class="update_request_error ? 'error' : 'ok'">
{{ update_request_status }}
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
var myApp = angular.module('inventoryApp', []);
myApp.controller('update', function($scope, $http, $timeout) {
$scope.latch_pending = false;
$scope.latch_error = false;
$scope.latch_info = "module version ????";
$scope.update_request_status = "";
$scope.update_request_error = false;
$scope.check_status = function() {
$http({
method: 'GET',
url: window.location.origin + "/version"
}).then(
/* ok response */
function(rsp) {
console.log('got version rsp: ' + JSON.stringify(rsp.data));
$scope.latch_info = "module version " + rsp.data.module;
$scope.latch_pending = rsp.data.latch.pending;
$scope.latch_error = rsp.data.latch.failure;
if (!$scope.latch_pending) {
$scope.update_request_status = "";
}
$timeout($scope.check_status, 5000);
},
/* error response */
function(rsp) {
console.log("got error response: " + JSON.stringify(rsp));
$scope.latch_info = "communication error";
$scope.latch_pending = false;
$scope.latch_error = true;
$timeout($scope.check_status(), 5000);
}
);
}
$scope.launch_update = function() {
$scope.update_request_status = "sending update request";
$scope.update_request_error = false;
$scope.latch_pending = true;
$http({
method: 'GET',
url: window.location.origin + "/jobs/update"
}).then(
/* ok response */
function(rsp) {
$scope.update_request_status = "update is running";
$scope.update_request_error = false;
console.log('got update rsp: ' + JSON.stringify(rsp.data));
},
/* error response */
function(rsp) {
$scope.update_request_status = "update request failed";
$scope.update_request_error = true;
console.log("got error response: " + JSON.stringify(rsp));
}
);
}
$scope.check_status();
});
\ No newline at end of file
...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages ...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup( setup(
name='inventory-provider', name='inventory-provider',
version="0.31", version="0.32",
author='GEANT', author='GEANT',
author_email='swd@geant.org', author_email='swd@geant.org',
description='Dashboard inventory provider', description='Dashboard inventory provider',
......
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