diff options
author | Christian Heimes <christian@python.org> | 2015-11-11 15:16:01 +0100 |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2015-11-11 15:16:01 +0100 |
commit | 512bfa79a4de8f7e601856f2feeb6809dc18247c (patch) | |
tree | 715d07c661141d22c734c394fe3c5e8b1a2daa0a | |
parent | ffc5ceee7ef098e19cd70572bfaa214c5c50878c (diff) | |
download | custodia_pwmgr-master.tar.gz custodia_pwmgr-master.tar.xz custodia_pwmgr-master.zip |
Signed-off-by: Christian Heimes <christian@python.org>
-rwxr-xr-x | custodia_pwmgr/custodia_pwmgr.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/custodia_pwmgr/custodia_pwmgr.py b/custodia_pwmgr/custodia_pwmgr.py index d0ca754..11c6e2a 100755 --- a/custodia_pwmgr/custodia_pwmgr.py +++ b/custodia_pwmgr/custodia_pwmgr.py @@ -27,7 +27,8 @@ import sys from urllib import quote from flask import Flask, flash, render_template, redirect, request, url_for -from custodia.client import CustodiaClient +from custodia.client import CustodiaSimpleClient +from custodia.log import setup_logging from requests.exceptions import RequestException # get Unix socket from env @@ -49,6 +50,7 @@ app.config.update( DEBUG=True, ) +setup_logging(debug=app.config['DEBUG'], auditfile=None) class FlaskCustodia(object): def __init__(self, app=None): @@ -59,7 +61,7 @@ class FlaskCustodia(object): url = app.config['CUSTODIA_URL'] # timeout = app.config.get('custodia_timeout') self._container = app.config['CUSTODIA_CONTAINER'] - self._client = CustodiaClient(url) + self._client = CustodiaSimpleClient(url) self._client.headers['REMOTE_USER'] = self._container #self.mkcontainer() @@ -79,21 +81,20 @@ class FlaskCustodia(object): return True def items(self): - r = self._client.list_container(self._container) - return r.json() + return self._client.list_container(self._container) def get_simple(self, name): - return self._client.get_simple_key( + return self._client.get_secret( self._genpath(name)) def set_simple(self, name, value): if not isinstance(value, basestring): raise TypeError(value) - return self._client.set_simple_key( + return self._client.set_secret( self._genpath(name), value) def delete(self, name): - return self._client.del_key(self._genpath(name)) + return self._client.del_secret(self._genpath(name)) flaskcustodia = FlaskCustodia(app) |