Skip to content

Commit

Permalink
jobs.py: don't yield jobs twice (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismaes87 authored and lechat committed Oct 25, 2019
1 parent 09304b9 commit dce4073
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jenkinsapi/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ def iteritems(self):
Iterate over the names & objects for all jobs
"""
for job in self.itervalues():
yield job.name, job
if job.name != job.get_full_name():
yield job.get_full_name(), job
else:
yield job.name, job

def __contains__(self, job_name):
"""
Expand All @@ -110,12 +111,13 @@ def iterkeys(self):
if not self._data:
self._data = self.poll().get('jobs', [])
for row in self._data:
yield row['name']
if row['name'] != \
Job.get_full_name_from_url_and_baseurl(row['url'],
self.jenkins.baseurl):
yield Job.get_full_name_from_url_and_baseurl(
row['url'], self.jenkins.baseurl)
else:
yield row['name']

def itervalues(self):
"""
Expand Down

0 comments on commit dce4073

Please sign in to comment.