Olivier Sallou pushed to branch upstream at Debian Med / biomaj3-user


Commits:
0b2b5726 by Olivier Sallou at 2019-11-12T10:30:34Z
New upstream version 3.0.10
- - - - -


3 changed files:

- CHANGES.txt
- bin/biomaj-users.py
- setup.py


Changes:

=====================================
CHANGES.txt
=====================================
@@ -1,3 +1,7 @@
+3.0.10:
+  Force yaml loader to skip warning on output
+3.0.9:
+  Add json output to biomaj_user script
 3.0.8:
   Fix traefik prefix
 3.0.7:


=====================================
bin/biomaj-users.py
=====================================
@@ -6,6 +6,7 @@ import yaml
 import string
 import sys
 import bcrypt
+import json
 from tabulate import tabulate
 from biomaj_user.user import BmajUser
 from biomaj_core.utils import Utils
@@ -21,6 +22,7 @@ def main():
                         help="Action to perform for user " + 
str(SUPPORTED_ACTIONS) +
                              "'renew': Create new api key",
                         required=True)
+    parser.add_argument('-J', '--json', dest="json", help="output to json", 
action='store_true')
     parser.add_argument('-C', '--config', dest="config", 
metavar='</path/to/config.yml>', type=str,
                         help="Path to config.yml. By default read from env 
variable BIOMAJ_CONFIG")
     parser.add_argument('-E', '--email', dest="email", type=str,
@@ -44,7 +46,7 @@ def main():
     else:
         config = 'config.yml'
     with open(config, 'r') as ymlfile:
-        config = yaml.load(ymlfile)
+        config = yaml.load(ymlfile, Loader=yaml.FullLoader)
         Utils.service_config_override(config)
 
     BmajUser.set_config(config)
@@ -58,6 +60,10 @@ def main():
                     options.passwd = 
''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits)
                                          for _ in range(10))
             user.create(options.passwd, email=options.email)
+            if options.json:
+                del user.user['_id']
+                print(json.dumps(user.user))
+                sys.exit(0)
             print("User successfully created")
             print(tabulate([["User", "Password", "API Key"],
                             [user.user['id'], str(options.passwd), 
str(user.user['apikey'])]],


=====================================
setup.py
=====================================
@@ -21,7 +21,7 @@ config = {
     'url': 'http://biomaj.genouest.org',
     'download_url': 'http://biomaj.genouest.org',
     'author_email': '[email protected]',
-    'version': '3.0.8',
+    'version': '3.0.10',
      'classifiers': [
         # How mature is this project? Common values are
         #   3 - Alpha



View it on GitLab: 
https://salsa.debian.org/med-team/biomaj3-user/commit/0b2b57265896e7c473b201571c3ff1049b880887

-- 
View it on GitLab: 
https://salsa.debian.org/med-team/biomaj3-user/commit/0b2b57265896e7c473b201571c3ff1049b880887
You're receiving this email because of your account on salsa.debian.org.


_______________________________________________
debian-med-commit mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to