Skip to content

Commit

Permalink
Errata install, and legacy chost methods
Browse files Browse the repository at this point in the history
  • Loading branch information
damoore044 committed May 18, 2024
1 parent 7d3efbd commit c6e0766
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
6 changes: 4 additions & 2 deletions airgun/entities/contenthost.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ 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.wait_displayed()
view.packages_installed.search(package_name)
return view.packages_installed.table.read()

Expand All @@ -145,7 +146,8 @@ def install_errata(self, entity_name, errata_id, install_via='rex'):
: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)
view.errata.wait_displayed()
if errata_id == "All":
view.errata.select_all.fill(True)
else:
Expand Down
25 changes: 21 additions & 4 deletions airgun/entities/errata.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ 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):
"""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 'All' for any available hosts,
or pass a list of str hostnames,
or single str hostname.
"""
view = self.navigate_to(
self,
Expand All @@ -73,8 +76,22 @@ 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)
view.content_hosts.wait_displayed()
if host_names == "All":
# clear search to show all hosts, select_all
view.content_hosts.search(" ")
for row in view.content_hosts.table.row():
row[0].fill(True)
elif isinstance(host_names, list):
# clear search to show all hosts
view.content_hosts.search(" ")
# find and select hostnames 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.table.row(name=host_names)[0].fill(True)
view.content_hosts.apply.click()
view = ErrataInstallationConfirmationView(view.browser)
view.confirm.click()
Expand Down

0 comments on commit c6e0766

Please sign in to comment.