data_source: fix check of configuration around signature_key

This commit is contained in:
Benjamin Dauvergne 2014-07-01 15:46:44 +02:00
parent d7d8162e35
commit 18212be91c
1 changed files with 3 additions and 1 deletions

View File

@ -70,7 +70,9 @@ class Renderer(template.TemplateRenderer):
if 'auth_mech' in source:
if source['auth_mech'] not in ('hmac-sha1', 'hmac-sha256', 'oauth2'):
yield 'unknown auth_mech {0!r}'.format(source['auth_mech'])
if 'signature_key' not in source or not isinstance(source['signature_key']):
if source['auth_mech'].startswith('hmac-') \
and ('signature_key' not in source
or not isinstance(source['signature_key'])):
yield 'missing signature_key string'
def get_sources(self, context):