Skip to content

Commit

Permalink
Enabling redhat repositories enhanced
Browse files Browse the repository at this point in the history
(cherry picked from commit 01ca4f2)
  • Loading branch information
LadislavVasina1 authored and web-flow committed Sep 19, 2023
1 parent 7f8017c commit b183de4
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 b183de4

Please sign in to comment.