Skip to content

Commit

Permalink
Enabling redhat repositories enhanced (#978)
Browse files Browse the repository at this point in the history
(cherry picked from commit 01ca4f2)

Co-authored-by: Ladislav Vasina <[email protected]>
  • Loading branch information
Satellite-QE and LadislavVasina1 authored Sep 22, 2023
1 parent 7f8017c commit 5c34453
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions airgun/entities/redhat_repository.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from wait_for import wait_for

from airgun.entities.base import BaseEntity
from airgun.navigation import NavigateStep, navigator
from airgun.utils import retry_navigation
Expand Down Expand Up @@ -40,15 +42,19 @@ def read(self, entity_name=None, category='Available', recommended_repo=None):
entity_data['items'] = view.available.items(name=entity_name)[0].read_items()
return entity_data

def enable(self, entity_name, arch, version=None):
def enable(self, entity_name, arch, version=None, custom_query=None):
"""Enable a redhat repository.
:param str entity_name: The RH repository set name.
:param str arch: The system target repository architecture.
:param str version: (optional) The OS release version if mandatory for this repository.
:param str custom_query: (optional) The custom query to search for.
If custom_query is used, set entity_name to None when calling this function!!!
"""
view = self.navigate_to(self, 'All')
view.search(f'name = "{entity_name}"', category='Available')
wait_for(lambda: view.search_box.is_displayed, timeout=10, delay=1)
custom_query = f'name = "{entity_name}"' if custom_query is None else custom_query
view.search(custom_query, category='Available')
arch_version = f'{arch} {version}' if version else arch
view.available.items(name=entity_name)[0].enable(arch_version)
view.flash.assert_no_error()
Expand Down

0 comments on commit 5c34453

Please sign in to comment.