Skip to content

Commit

Permalink
Add markdown format output to bodhi plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
  • Loading branch information
sandrobonazzola authored and psss committed Nov 10, 2023
1 parent 6f9b68d commit 014a793
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions did/plugins/bodhi.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,20 @@ def search(self, query):
class Update(object):
""" Bodhi update """

def __init__(self, data):
def __init__(self, data, format):
self.data = data
self.format = format
self.title = data['title']
self.project = data['release']['name']
self.identifier = data['alias']
self.created = data['date_submitted']
self.url = data['url']
log.details('[{0}] {1}'.format(self.created, self))

def __str__(self):
""" String representation """
if self.format == "markdown":
return f'[{self.identifier}]({self.url}) - {self.title} [{self.project}]'
return f'{self.identifier} - {self.title} [{self.project}]'


Expand All @@ -81,7 +85,8 @@ class UpdatesCreated(Stats):
def fetch(self):
log.info('Searching for updates created by {0}'.format(self.user))
self.stats = [
Update(update) for update in self.parent.bodhi.search(
Update(update, self.parent.options.format)
for update in self.parent.bodhi.search(
query='updates/?user={0}&submitted_before={1}'
'&submitted_since={2}'.format(
self.user.login, self.options.until.date,
Expand Down

0 comments on commit 014a793

Please sign in to comment.