diff options
author | Jingjing Duan <jduan@twitter.com> | 2014-06-09 15:02:23 -0700 |
---|---|---|
committer | Jingjing Duan <jduan@twitter.com> | 2014-06-09 15:02:23 -0700 |
commit | e5e4fb13727f19e33463c7227a8a0890ef4e4725 (patch) | |
tree | d0b51fba0fd0d3e05c857ad9286d495b5e4fdf41 /jenkinsapi | |
parent | ce6779b1adf523418aca7fd4552ad47f1af7897d (diff) | |
download | python-jenkinsapi-e5e4fb13727f19e33463c7227a8a0890ef4e4725.tar.gz python-jenkinsapi-e5e4fb13727f19e33463c7227a8a0890ef4e4725.tar.bz2 python-jenkinsapi-e5e4fb13727f19e33463c7227a8a0890ef4e4725.zip |
add get_causes
Diffstat (limited to 'jenkinsapi')
-rw-r--r-- | jenkinsapi/build.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/jenkinsapi/build.py b/jenkinsapi/build.py index da04fd8..a0a2d7a 100644 --- a/jenkinsapi/build.py +++ b/jenkinsapi/build.py @@ -361,6 +361,21 @@ class Build(JenkinsBase): all_actions.update(dct_action) return all_actions + def get_causes(self): + ''' + Returns a list of causes. There can be multiple causes lists and + some of the can be empty. For instance, when a build is manually + aborted, Jenkins could add an empty causes list to the actions + dict. Empty ones are ignored. + ''' + all_causes = [] + for dct_action in self._data["actions"]: + if dct_action is None: + continue + if 'causes' in dct_action and dct_action['causes']: + all_causes.extend(dct_action['causes']) + return all_causes + def get_timestamp(self): ''' Returns build timestamp in UTC |