diff options
author | Oliver Poignant <oliver@poignant.se> | 2016-05-18 21:14:21 +0200 |
---|---|---|
committer | Oliver Poignant <oliver@poignant.se> | 2016-05-18 21:14:21 +0200 |
commit | a7c118a8446da3edb32d2c06b11a3317ebe4a22d (patch) | |
tree | 3caa39b8a4114a85ce3282c24e44f806f2b20086 /gitautodeploy/httpserver.py | |
parent | f3549261d30ae22fc86977a2a8661f965d95684f (diff) | |
download | Git-Auto-Deploy-a7c118a8446da3edb32d2c06b11a3317ebe4a22d.zip Git-Auto-Deploy-a7c118a8446da3edb32d2c06b11a3317ebe4a22d.tar.gz Git-Auto-Deploy-a7c118a8446da3edb32d2c06b11a3317ebe4a22d.tar.bz2 |
Handle legacy filter config syntax
Diffstat (limited to 'gitautodeploy/httpserver.py')
-rw-r--r-- | gitautodeploy/httpserver.py | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/gitautodeploy/httpserver.py b/gitautodeploy/httpserver.py index 435e77c..96ba5cf 100644 --- a/gitautodeploy/httpserver.py +++ b/gitautodeploy/httpserver.py @@ -188,29 +188,21 @@ class WebhookRequestHandler(BaseHTTPRequestHandler): # All options specified in the filter must match for filter_key, filter_value in filter.iteritems(): - # Support for earlier version so it's non-breaking functionality - if filter_key == 'action' and filter_value == action: + # Ignore filters with value None (let them pass) + if filter_value == None: continue - # Support for legacy config syntax - if filter_key == 'kind' and filter_value == 'pull-request-handler' and 'pull_request' in data: - logger.info('filter %s passed', filter_key) + # Support for earlier version so it's non-breaking functionality + if filter_key == 'action' and filter_value == action: continue - # Handled below - #if filter_key in data and filter_value == data[filter_key]: - # continue - - # Handled below - #if filter_key in data and filter_value == True: - # continue - # Interpret dots in filter name as path notations node_value = data for node_key in filter_key.split('.'): # If the path is not valid the filter does not match if not node_key in node_value: + logger.info("Filter '%s'' does not match since the path is invalid" % (filter_key)) raise FilterMatchError() node_value = node_value[node_key] @@ -223,12 +215,7 @@ class WebhookRequestHandler(BaseHTTPRequestHandler): if filter_value == True: continue - if isinstance(node_value, dict): - node_value_str = "object" - else: - node_value_str = node_value - - logger.info("Filter '%s'' does not match ('%s' != '%s')" % (filter_key, filter_value, node_value_str)) + logger.info("Filter '%s'' does not match ('%s' != '%s')" % (filter_key, filter_value, (str(node_value)[:75] + '..') if len(str(node_value)) > 75 else str(node_value))) raise FilterMatchError() |