diff options
Diffstat (limited to 'custodia_pwmgr/custodia_pwmgr.py')
-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) |