[med-svn] [Git][med-team/biomaj3-daemon][master] 14 commits: routine-update: New upstream version
Andreas Tille
gitlab at salsa.debian.org
Sun Jan 17 08:41:21 GMT 2021
Andreas Tille pushed to branch master at Debian Med / biomaj3-daemon
Commits:
d330f42f by Andreas Tille at 2021-01-17T09:29:03+01:00
routine-update: New upstream version
- - - - -
500e1c66 by Andreas Tille at 2021-01-17T09:29:04+01:00
New upstream version 3.0.22
- - - - -
95e80c3a by Andreas Tille at 2021-01-17T09:29:04+01:00
Update upstream source from tag 'upstream/3.0.22'
Update to upstream version '3.0.22'
with Debian dir 24941839c475f856d993f136b6c527773b92a6e2
- - - - -
62b5acb6 by Andreas Tille at 2021-01-17T09:29:04+01:00
routine-update: Standards-Version: 4.5.1
- - - - -
e80a7fcb by Andreas Tille at 2021-01-17T09:29:05+01:00
routine-update: debhelper-compat 13
- - - - -
7adaf954 by Andreas Tille at 2021-01-17T09:29:09+01:00
routine-update: Testsuite: autopkgtest-pkg-python
- - - - -
2c37f179 by Andreas Tille at 2021-01-17T09:29:09+01:00
routine-update: Remove trailing whitespace in debian/changelog
- - - - -
2f050eca by Andreas Tille at 2021-01-17T09:29:09+01:00
routine-update: Remove trailing whitespace in debian/copyright
- - - - -
ecc13b4c by Andreas Tille at 2021-01-17T09:29:09+01:00
routine-update: Add salsa-ci file
- - - - -
639975c8 by Andreas Tille at 2021-01-17T09:29:09+01:00
routine-update: Rules-Requires-Root: no
- - - - -
500656e4 by Andreas Tille at 2021-01-17T09:29:13+01:00
Set upstream metadata fields: Bug-Database, Bug-Submit, Repository, Repository-Browse.
Changes-By: lintian-brush
Fixes: lintian: upstream-metadata-missing-bug-tracking
See-also: https://lintian.debian.org/tags/upstream-metadata-missing-bug-tracking.html
Fixes: lintian: upstream-metadata-missing-repository
See-also: https://lintian.debian.org/tags/upstream-metadata-missing-repository.html
- - - - -
3b82a87f by Andreas Tille at 2021-01-17T09:34:28+01:00
d/rules: Replace DEB_BUILD_OPTIONS by DEB_BUILD_MAINT_OPTIONS
- - - - -
426b9671 by Andreas Tille at 2021-01-17T09:36:00+01:00
Lintian override for script-with-language-extension
- - - - -
eaf9c948 by Andreas Tille at 2021-01-17T09:37:45+01:00
Upload to unstable
- - - - -
16 changed files:
- .travis.yml
- CHANGES.txt
- README.md
- biomaj_daemon/daemon/biomaj_daemon_web.py
- biomaj_daemon/daemon/daemon_service.py
- biomaj_daemon/daemon/utils.py
- debian/changelog
- − debian/compat
- debian/control
- debian/copyright
- + debian/lintian-overrides
- debian/rules
- + debian/salsa-ci.yml
- debian/upstream/metadata
- requirements.txt
- setup.py
Changes:
=====================================
.travis.yml
=====================================
@@ -1,13 +1,16 @@
language: python
sudo: false
python:
-- '2.7'
-- '3.4'
-- '3.5'
- '3.6'
+- '3.7'
+- '3.8'
branches:
except:
- "/^feature.*$/"
+addons:
+ apt:
+ packages:
+ - libgnutls-dev
install:
- pip install flake8
- pip install -r requirements.txt
=====================================
CHANGES.txt
=====================================
@@ -1,3 +1,10 @@
+3.0.22:
+ Add /api/daemon/expose endpoint for traefik auth requests
+ to allow/deny access to /db web access
+3.0.21:
+ Add support for repair option
+ Add cors support
+ Fix /status/ko
3.0.20:
Add some checks on options
Add data-list and data-import options
=====================================
README.md
=====================================
@@ -1,5 +1,7 @@
# About
+[![PyPI version](https://badge.fury.io/py/biomaj-daemon.svg)](https://badge.fury.io/py/biomaj-daemon)
+
Microservice to manage biomaj, acts as a frontend to receive biomaj-cli commands and execute operations
Needs mongo and redis
=====================================
biomaj_daemon/daemon/biomaj_daemon_web.py
=====================================
@@ -4,12 +4,14 @@ import yaml
import logging
from collections import deque
import copy
+import base64
from flask import Flask
from flask import jsonify
from flask import request
from flask import abort
from flask import Response
+from flask_cors import CORS
import requests
@@ -75,6 +77,7 @@ SchemaVersion.migrate_pendings()
SchemaVersion.set_version()
app = Flask(__name__)
+CORS(app)
biomaj_metric = Counter("biomaj_daemon_total", "Bank total update execution.", ['bank', 'action', 'updated'])
biomaj_error_metric = Counter("biomaj_daemon_errors", "Bank total update errors.", ['bank', 'action'])
@@ -156,7 +159,8 @@ OPTIONS_PARAMS = {
'history': False,
'historyLimit': 20,
'datalist': False,
- 'dataimport': False
+ 'dataimport': False,
+ 'repair': False
}
@@ -678,7 +682,7 @@ def biomaj_daemon_bank_update_status(bank):
@app.route('/api/daemon/status/ko', methods=['GET'])
-def biomaj_daemon_bank_status_ko(bank):
+def biomaj_daemon_bank_status_ko():
(http_code, options, error) = daemon_api_auth(request)
if error:
abort(http_code, error)
@@ -795,6 +799,31 @@ def biomaj_daemon_bank_update_directory(bank):
abort(500, str(e))
+ at app.route('/api/daemon/bank/<bank>/repair', methods=['PUT'])
+def biomaj_daemon_bank_repair(bank):
+ (http_code, options, error) = daemon_api_auth(request)
+ if error:
+ abort(http_code, error)
+ if not options.user:
+ abort(401, 'This action requires authentication with api key')
+ options.repair = True
+ options.bank = bank
+ params = request.get_json()
+ if params is None:
+ params = {}
+ if 'release' in params:
+ options.release = params['release']
+ try:
+ (res, msg) = biomaj_client_action(options, config)
+ if res:
+ if isinstance(msg, dict):
+ return jsonify(msg)
+ else:
+ return jsonify({'msg': msg})
+ except Exception as e:
+ abort(500, str(e))
+
+
@app.route('/api/daemon/bank/<bank>', methods=['POST'])
def biomaj_daemon_bank_update(bank):
(http_code, options, error) = daemon_api_auth(request)
@@ -1079,6 +1108,46 @@ def add_metrics():
return jsonify({'msg': 'OK'})
+ at app.route('/api/daemon/expose', methods=['GET'])
+def expose():
+ do_expose = True
+ try:
+ do_expose_cfg = BiomajConfig.global_config.get('GENERAL', 'expose')
+ if do_expose_cfg == "false" or do_expose_cfg == "0":
+ do_expose = False
+
+ except Exception:
+ do_expose = True
+ if not do_expose:
+ abort(403)
+ uri = request.headers['X-Forwarded-Uri']
+ if uri == '/db' or uri == '/db/':
+ return jsonify({'msg': 'access allowed'})
+ elts = uri.split('/')
+ requested_bank = elts[2]
+ user = None
+ options = Options({})
+ bank = Bank(requested_bank, options=Options({}), no_log=True)
+ if bank.bank['properties']['visibility'] == 'public':
+ return jsonify({'msg': 'access allowed'})
+
+ if not request.headers.get('Authorization', None):
+ abort(403)
+ encoded_uname_pass = request.headers.get('Authorization').split()[-1]
+ uname_pass = base64.b64decode(encoded_uname_pass)
+ apikey = uname_pass.split(':')[-1]
+ proxy = Utils.get_service_endpoint(config, 'user')
+ r = requests.get(proxy + '/api/user/info/apikey/' + apikey)
+ if not r.status_code == 200:
+ abort(404, {'message': 'Invalid API Key or connection issue'})
+ user = r.json()['user']
+ options = Options({'user': user['id']})
+ bank = Bank(requested_bank, options=options, no_log=True)
+ if not bank.is_owner():
+ abort(403)
+ return jsonify({'msg': 'access allowed'})
+
+
if __name__ == "__main__":
context = None
if config['tls']['cert']:
=====================================
biomaj_daemon/daemon/daemon_service.py
=====================================
@@ -204,6 +204,15 @@ class DaemonService(object):
elif options.removepending:
bmaj = Bank(options.bank, options, no_log=True)
bmaj.remove_pending(options.release)
+ elif options.repair:
+ action = 'repair'
+ self.__start_action(options.bank, action)
+ bmaj = Bank(options.bank, options)
+ self.logger.debug('Log file: ' + bmaj.config.log_file)
+ is_ok = bmaj.repair()
+ is_updated = bmaj.session.get('update')
+ Notify.notifyBankAction(bmaj)
+ self.__end_action()
except Exception as e:
self.logger.exception('Exception: ' + str(e))
is_ok = False
=====================================
biomaj_daemon/daemon/utils.py
=====================================
@@ -422,6 +422,13 @@ def biomaj_bank_update_request(options, config):
return biomaj_send_message(options, config)
+def biomaj_bank_repair_request(options, config):
+ '''
+ Send bank repair request to rabbitmq
+ '''
+ return biomaj_send_message(options, config)
+
+
def biomaj_whatsup(options, config):
redis_client = None
whatsup = []
@@ -498,6 +505,43 @@ def biomaj_send_message(options, config):
return (True, None)
+def biomaj_bank_repair(options, config):
+ '''
+ Repair a bank
+ '''
+ if not options.bank:
+ return (False, "Bank name is missing")
+ banks = options.bank.split(',')
+ gres = True
+ msg = ''
+ for bank in banks:
+ options.bank = bank
+ no_log = True
+ if not options.proxy:
+ no_log = False
+ # logging.debug('Options: '+str(options.__dict__))
+ bmaj = Bank(bank, options=options, no_log=no_log)
+ check_status = bmaj.check()
+ if not check_status:
+ msg += 'Skip bank ' + options.bank + ': wrong config\n'
+ gres = False
+ continue
+ else:
+ msg += 'Bank repair request sent for ' + options.bank + '\n'
+ if not options.proxy:
+ res = bmaj.repair()
+ Notify.notifyBankAction(bmaj)
+ else:
+ res = biomaj_bank_repair_request(options, config)
+ if not res:
+ msg += 'Failed to send repair request for ' + options.bank + '\n'
+ gres = False
+
+ if not gres:
+ return (False, msg)
+ return (True, msg)
+
+
def biomaj_bank_update(options, config):
'''
Update a bank
@@ -953,4 +997,7 @@ def biomaj_client_action(options, config=None):
if options.dataimport:
return biomaj_data_import(options, config)
+ if options.repair:
+ return biomaj_bank_repair(options, config)
+
return (False, "no option match")
=====================================
debian/changelog
=====================================
@@ -1,12 +1,30 @@
+biomaj3-daemon (3.0.22-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream version
+ * Standards-Version: 4.5.1 (routine-update)
+ * debhelper-compat 13 (routine-update)
+ * Testsuite: autopkgtest-pkg-python (routine-update)
+ * Remove trailing whitespace in debian/changelog (routine-update)
+ * Remove trailing whitespace in debian/copyright (routine-update)
+ * Add salsa-ci file (routine-update)
+ * Rules-Requires-Root: no (routine-update)
+ * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository,
+ Repository-Browse.
+ * d/rules: Replace DEB_BUILD_OPTIONS by DEB_BUILD_MAINT_OPTIONS
+ * Lintian override for script-with-language-extension
+
+ -- Andreas Tille <tille at debian.org> Sun, 17 Jan 2021 09:36:30 +0100
+
biomaj3-daemon (3.0.20-1) unstable; urgency=medium
- * New upstream release
+ * New upstream release
-- Olivier Sallou <osallou at debian.org> Tue, 12 Nov 2019 10:34:19 +0000
biomaj3-daemon (3.0.19-1) unstable; urgency=medium
- * New upstream release
+ * New upstream release
-- Olivier Sallou <osallou at debian.org> Sat, 09 Mar 2019 10:23:28 +0000
=====================================
debian/compat deleted
=====================================
@@ -1 +0,0 @@
-9
=====================================
debian/control
=====================================
@@ -1,9 +1,10 @@
Source: biomaj3-daemon
Section: python
+Testsuite: autopkgtest-pkg-python
Priority: optional
Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
Uploaders: Olivier Sallou <osallou at debian.org>
-Build-Depends: debhelper (>= 9), dh-python,
+Build-Depends: debhelper-compat (= 13), dh-python,
protobuf-compiler,
python3-all,
python3-bcrypt,
@@ -21,8 +22,9 @@ Build-Depends: debhelper (>= 9), dh-python,
python3-biomaj3-core,
python3-biomaj3-zipkin,
python3-biomaj3
-Standards-Version: 4.1.3
+Standards-Version: 4.5.1
Homepage: https://github.com/genouest/biomaj-daemon
+Rules-Requires-Root: no
Vcs-Browser: https://salsa.debian.org/med-team/biomaj3-daemon
Vcs-Git: https://salsa.debian.org/med-team/biomaj3-daemon.git
=====================================
debian/copyright
=====================================
@@ -424,7 +424,7 @@ License: AGPL-3
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
- received notice of violation of this License (for any work) from that
+ received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
.
@@ -537,7 +537,7 @@ License: AGPL-3
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
- .
+ .
12. No Surrender of Others' Freedom.
.
If conditions are imposed on you (whether by court order, agreement or
=====================================
debian/lintian-overrides
=====================================
@@ -0,0 +1,2 @@
+# see https://lists.debian.org/debian-med/2018/06/msg00043.html
+python3-biomaj3-daemon: script-with-language-extension usr/bin/*.*
=====================================
debian/rules
=====================================
@@ -1,6 +1,6 @@
#! /usr/bin/make -f
-export DEB_BUILD_OPTIONS=nocheck
+export DEB_BUILD_MAINT_OPTIONS=nocheck
export PYBUILD_NAME=biomaj-daemon
%:
=====================================
debian/salsa-ci.yml
=====================================
@@ -0,0 +1,4 @@
+---
+include:
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
=====================================
debian/upstream/metadata
=====================================
@@ -1,3 +1,5 @@
+Bug-Database: https://github.com/genouest/biomaj-daemon/issues
+Bug-Submit: https://github.com/genouest/biomaj-daemon/issues/new
Registry:
- Name: OMICtools
Entry: OMICS_21717
@@ -5,3 +7,5 @@ Registry:
Entry: NA
- Name: bio.tools
Entry: biomaj
+Repository: https://github.com/genouest/biomaj-daemon.git
+Repository-Browse: https://github.com/genouest/biomaj-daemon
=====================================
requirements.txt
=====================================
@@ -7,4 +7,5 @@ python-consul
prometheus_client>=0.0.18
requests
biomaj-core>=3.0.16
-biomaj>=3.1.7
+biomaj>=3.1.14
+flask-cors
=====================================
setup.py
=====================================
@@ -21,7 +21,7 @@ config = {
'url': 'http://biomaj.genouest.org',
'download_url': 'http://biomaj.genouest.org',
'author_email': 'olivier.sallou at irisa.fr',
- 'version': '3.0.20',
+ 'version': '3.0.22',
'classifiers': [
# How mature is this project? Common values are
# 3 - Alpha
@@ -51,7 +51,8 @@ config = {
'flask',
'python-consul',
'prometheus_client>=0.0.18',
- 'requests'
+ 'requests',
+ 'flask-cors'
],
'tests_require': ['nose', 'mock'],
'test_suite': 'nose.collector',
View it on GitLab: https://salsa.debian.org/med-team/biomaj3-daemon/-/compare/55214e8329629a17490c37288ba8b79686a1f676...eaf9c9483b429ca7435a42713d6c73c7fde8d1b9
--
View it on GitLab: https://salsa.debian.org/med-team/biomaj3-daemon/-/compare/55214e8329629a17490c37288ba8b79686a1f676...eaf9c9483b429ca7435a42713d6c73c7fde8d1b9
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210117/d1952890/attachment-0001.html>
More information about the debian-med-commit
mailing list