Skip to content

Commit

Permalink
Merge pull request #1428 from SatelliteQE/cherry-pick-6.15.z-8679750d…
Browse files Browse the repository at this point in the history
…b5e7e4c82a0dded3d15726eef181bd54

[6.15.z] Errata-UI install work, & legacy chost methods
  • Loading branch information
damoore044 authored Jun 24, 2024
2 parents 9ab0041 + 7b1ffeb commit 1c541d4
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 12 deletions.
7 changes: 4 additions & 3 deletions airgun/entities/contenthost.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def execute_module_stream_action(

def search_package(self, entity_name, package_name):
"""Search for specific package installed in content host"""
view = self.navigate_to(self, 'Edit', entity_name=entity_name)
view = self.navigate_to(self, 'LegacyDetails', entity_name=entity_name)
view.packages_installed.search(package_name)
return view.packages_installed.table.read()

Expand All @@ -137,13 +137,14 @@ def install_errata(self, entity_name, errata_id, install_via='rex'):
"""Install errata on a content host
:param name: content host name to apply errata on
:param errata_id: errata id or title, e.g. 'RHEA-2012:0055'
:param errata_id: str: errata id or title, e.g. 'RHEA-2012:0055'
or pass "All" to select all available errata available for host,
:param str install_via: via which mean to install errata. Available
options: "katello", "rex", "rex_customize"
:return: Returns a dict containing task status details
"""
view = self.navigate_to(self, 'Edit', entity_name=entity_name)
view = self.navigate_to(self, 'LegacyDetails', entity_name=entity_name)
if errata_id == "All":
view.errata.select_all.fill(True)
else:
Expand Down
37 changes: 30 additions & 7 deletions airgun/entities/errata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from airgun.views.errata import (
ErrataDetailsView,
ErrataInstallationConfirmationView,
ErrataTaskDetailsView,
ErratumView,
)
from airgun.views.job_invocation import JobInvocationStatusView


class ErrataEntity(BaseEntity):
Expand Down Expand Up @@ -59,11 +59,16 @@ def read(
view.content_hosts.environment_filter.fill(environment)
return view.read(widget_names=widget_names)

def install(self, entity_name, host_name):
def install(self, entity_name, host_names, environment=None):
"""Install errata on content host.
:param str entity_name: errata id or title
:param str host_name: content host name to apply errata on
:param str host_names: content host name to apply errata on.
pass a single str hostname,
or pass 'All' for any available hosts,
or pass a list of str hostnames.
:param str environment: name of lifecycle environment to scope errata.
default: None
"""
view = self.navigate_to(
self,
Expand All @@ -73,13 +78,31 @@ def install(self, entity_name, host_name):
installable=False,
repo=None,
)
view.content_hosts.search(host_name)
view.content_hosts.table.row(name=host_name)[0].fill(True)
if environment:
view.content_hosts.environment_filter.fill(environment)
view.content_hosts.wait_displayed()

if host_names == 'All':
# select_all on table, check if single or multiple hosts
view.content_hosts.select_all.fill(True)
elif isinstance(host_names, list):
# find and select hostnames in table from list
for hostname in host_names:
view.content_hosts.table.row(name=hostname)[0].fill(True)
else:
# search and select the single passed hostname
view.content_hosts.search(host_names)
view.content_hosts.wait_displayed()
view.content_hosts.table.row(name=host_names)[0].fill(True)
view.content_hosts.wait_displayed()
view.content_hosts.apply.click()
# brought to confirmation page
view = ErrataInstallationConfirmationView(view.browser)
view.wait_displayed()
view.confirm.click()
view = ErrataTaskDetailsView(view.browser)
view.progressbar.wait_for_result()
# wait for redirect to task details page
view = JobInvocationStatusView(view.browser)
view.wait_for_result(delay=0.01, timeout=1200)
return view.read()

def search_content_hosts(self, entity_name, value, environment=None):
Expand Down
1 change: 1 addition & 0 deletions airgun/entities/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ def get_packages(self, entity_name, search=""):
"""Filter installed packages on host"""
view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)
view.content.packages.select()
view.content.packages.table.wait_displayed()
view.content.packages.searchbar.fill(search)
# wait for filter to apply
self.browser.plugin.ensure_page_safe()
Expand Down
3 changes: 2 additions & 1 deletion airgun/views/errata.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class content_hosts(SatTab):
TAB_NAME = 'Content Hosts'
environment_filter = SatSelect(".//select[@ng-model='environmentFilter']")
searchbox = Search()
select_all = Checkbox(locator=".//input[@type='checkbox'][@ng-change='allSelected()']")
apply = Text(".//button[@ng-click='goToNextStep()']")
table = SatTable(
locator=".//table",
Expand Down Expand Up @@ -188,7 +189,7 @@ def is_displayed(self):

class ErrataInstallationConfirmationView(BaseLoggedInView):
cancel = Text(".//button[@ng-click='transitionBack()']")
confirm = Text(".//button[@type='submit']")
confirm = Text(".//span[text()='Confirm']")


class ErrataTaskDetailsView(TaskDetailsView):
Expand Down
4 changes: 3 additions & 1 deletion airgun/views/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ class packages(Tab):
ROOT = './/div[@id="packages-tab"]'

select_all = Checkbox(locator='.//div[@id="selection-checkbox"]/div/label')
searchbar = SearchInput(locator='.//input[contains(@class, "pf-m-search")]')
searchbar = SearchInput(
locator='.//input[contains(@class, "pf-c-text-input-group__text-input")]'
)
status_filter = Dropdown(locator='.//div[@aria-label="select Status container"]/div')
upgrade = Pf4ActionsDropdown(locator='.//div[div/button[normalize-space(.)="Upgrade"]]')
dropdown = Dropdown(locator='.//div[button[@aria-label="bulk_actions"]]')
Expand Down

0 comments on commit 1c541d4

Please sign in to comment.