airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlo...@apache.org
Subject [6/8] incubator-airflow git commit: [AIRFLOW-228] Handle empty version list in PR tool
Date Tue, 12 Jul 2016 14:55:41 GMT
[AIRFLOW-228] Handle empty version list in PR tool

If the filter matched no version names, it would return an empty list
and the [0] index would fail.


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/8f863d7e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/8f863d7e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/8f863d7e

Branch: refs/heads/master
Commit: 8f863d7ea7908da0cab417d16f0634d7ec8bf29a
Parents: f3a05d4
Author: jlowin <jlowin@users.noreply.github.com>
Authored: Thu Jun 30 20:21:09 2016 -0400
Committer: jlowin <jlowin@users.noreply.github.com>
Committed: Thu Jun 30 20:40:42 2016 -0400

----------------------------------------------------------------------
 dev/airflow-pr | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/8f863d7e/dev/airflow-pr
----------------------------------------------------------------------
diff --git a/dev/airflow-pr b/dev/airflow-pr
index e3cb3d3..cb80766 100755
--- a/dev/airflow-pr
+++ b/dev/airflow-pr
@@ -552,11 +552,14 @@ def resolve_jira_issue(comment=None, jira_id=None, merge_branches=None):
         fix_versions = None
 
     def get_version_json(version_str):
-        return list(filter(lambda v: v.name == version_str, versions))[0].raw
+        version_list = list(filter(lambda v: v.name == version_str, versions))
+        if version_list:
+            return version_list[0].raw
+        else:
+            return ''
 
     if fix_versions and fix_versions != ['']:
-        jira_fix_versions = list(
-            map(lambda v: get_version_json(v), fix_versions))
+        jira_fix_versions = list(map(get_version_json, fix_versions))
     else:
         jira_fix_versions = None
 


Mime
View raw message