Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.14.z] Enabling RedHat repositories enhanced #978

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading