Skip to content

Commit

Permalink
Added possibility to search for debian errata (#1013)
Browse files Browse the repository at this point in the history
in the form DSA-1234-1
  • Loading branch information
dosas authored and vsedmik committed Jan 17, 2024
1 parent 273a64c commit 133e564
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions airgun/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import re

from airgun.settings import Settings

settings = Settings()

ERRATA_REGEXP = re.compile(r'\w{3,4}[:-]\d{4}[-:]\d{1,4}')
5 changes: 2 additions & 3 deletions airgun/entities/errata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re

from airgun import ERRATA_REGEXP
from airgun.entities.base import BaseEntity
from airgun.navigation import NavigateStep, navigator
from airgun.utils import retry_navigation
Expand Down Expand Up @@ -137,6 +136,6 @@ def step(self, *args, **kwargs):
repo = kwargs.get('repo')
self.parent.search(entity_name, applicable=applicable, installable=installable, repo=repo)
row_filter = {'title': entity_name}
if re.search(r'\w{3,4}[:-]\d{4}[-:]\d{4}', entity_name):
if ERRATA_REGEXP.search(entity_name):
row_filter = {'errata_id': entity_name}
self.parent.table.row(**row_filter)['Errata ID'].widget.click()
5 changes: 2 additions & 3 deletions airgun/views/errata.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import re

from widgetastic.widget import Checkbox, Text, View
from widgetastic_patternfly import BreadCrumb

from airgun import ERRATA_REGEXP
from airgun.views.common import BaseLoggedInView, SatTab, TaskDetailsView
from airgun.widgets import ItemsList, ReadOnlyEntry, SatSelect, SatTable, Search

Expand Down Expand Up @@ -40,7 +39,7 @@ def search(self, query, applicable=True, installable=False, repo=None):
if repo is not None:
self.repo_filter.fill(repo)

if re.search(r'\w{3,4}[:-]\d{4}[-:]\d{4}', query):
if ERRATA_REGEXP.search(query):
query = f'id = {query}'
self.searchbox.search(query)

Expand Down

0 comments on commit 133e564

Please sign in to comment.