Skip to content

Commit

Permalink
Remove katello-agent from entities and views (#1005)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsedmik authored Oct 19, 2023
1 parent 529749b commit b626540
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 67 deletions.
30 changes: 7 additions & 23 deletions airgun/entities/contenthost.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from airgun.views.contenthost import (
ContentHostDetailsView,
ContentHostsView,
ContentHostTaskDetailsView,
ErrataDetailsView,
SyspurposeBulkActionView,
)
Expand Down Expand Up @@ -49,35 +48,25 @@ def read_legacy_ui(self, entity_name, widget_names=None):
view = self.navigate_to(self, 'LegacyDetails', entity_name=entity_name)
return view.read(widget_names=widget_names)

def execute_package_action(self, entity_name, action_type, value, installed_via='rex'):
def execute_package_action(self, entity_name, action_type, value):
"""Execute remote package action on a content host.
The installation method is not set here, but the path changes according to the method used.
For katello-agent, the Content Hosts' Task tab displays the progress. If REX is used,
the Job Invocation view displays the progress. In 6.10, REX became the default method.
:param entity_name: content host name to remotely execute package
action on
:param action_type: remote action to execute. Can be one of 5: 'Package
Install', 'Package Update', 'Package Remove', 'Group Install' or
'Group Remove'
:param value: Package or package group group name to remotely
:param value: Package or package group name to remotely
install/upgrade/remove (depending on `action_type`)
:param installed_via: what installation method was used (REX or katello-agent)
:return: Returns a dict containing task status details
"""
view = self.navigate_to(self, 'Edit', entity_name=entity_name)
view.packages_actions.action_type.fill(action_type)
view.packages_actions.name.fill(value)
view.packages_actions.perform.click()
if installed_via == 'katello':
view = ContentHostTaskDetailsView(view.browser)
view.progressbar.wait_for_result()
else:
view = JobInvocationStatusView(view.browser)
view.wait_for_result()
view = JobInvocationStatusView(view.browser)
view.wait_for_result()
return view.read()

def bulk_set_syspurpose(self, hosts, values):
Expand Down Expand Up @@ -144,7 +133,7 @@ def search_module_stream(self, entity_name, module_name, stream_version=None, st
view.module_streams.search(query, status)
return view.module_streams.table.read()

def install_errata(self, entity_name, errata_id, install_via=None):
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
Expand All @@ -161,17 +150,12 @@ def install_errata(self, entity_name, errata_id, install_via=None):
view.errata.search(errata_id)
view.errata.table.row(id=errata_id)[0].widget.fill(True)
install_via_dict = {
'katello': 'via Katello agent',
'rex': 'via remote execution',
'rex_customize': 'via remote execution - customize first',
}
view.errata.apply_selected.fill(install_via_dict[install_via])
if install_via == 'katello':
view = ContentHostTaskDetailsView(view.browser)
view.progressbar.wait_for_result()
else:
view = JobInvocationStatusView(view.browser)
view.wait_for_result()
view = JobInvocationStatusView(view.browser)
view.wait_for_result()
return view.read()

def search_errata(self, entity_name, errata_id, environment=None):
Expand Down
69 changes: 29 additions & 40 deletions airgun/entities/hostcollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def manage_packages(
content_type='Package',
packages=None,
action='install',
action_via='via Katello Agent',
action_via='via remote execution',
job_values=None,
):
"""Manage host collection packages.
Expand All @@ -83,8 +83,7 @@ def manage_packages(
:param str action: The action to apply. Available options: install,
update, update_all, delete.
:param str action_via: Via which mean to apply action. Available
options: "via Katello Agent", "via remote execution",
"via remote execution - customize first"
options: "via remote execution", "via remote execution - customize first"
:param dict job_values: Remote Execution Job custom form values.
When action_via is: "via remote execution - customize first",
the new remote execution job form is opened and we can set custom
Expand All @@ -102,28 +101,25 @@ def manage_packages(
view.apply_action(action, action_via=action_via)
view.flash.assert_no_error()
view.flash.dismiss()
if action_via == 'via Katello Agent':
view.done.click()
if action_via == 'via remote execution - customize first':
# After this step the user is redirected to remote execution job
# create view.
job_create_view = HostCollectionActionRemoteExecutionJobCreate(view.browser)
job_create_view.fill(job_values)
job_create_view.submit.click()

if action_via in ('via remote execution', 'via remote execution - customize first'):
# After this step the user is redirected to job status view.
job_status_view = JobInvocationStatusView(view.browser)
wait_for(
lambda: (
job_status_view.overview.job_status.read() != 'Pending'
and job_status_view.overview.job_status_progress.read() == '100%'
),
timeout=300,
delay=10,
logger=view.logger,
)
return job_status_view.overview.read()
# After this step the user is redirected to job status view.
job_status_view = JobInvocationStatusView(view.browser)
wait_for(
lambda: (
job_status_view.overview.job_status.read() != 'Pending'
and job_status_view.overview.job_status_progress.read() == '100%'
),
timeout=300,
delay=10,
logger=view.logger,
)
return job_status_view.overview.read()

def search_applicable_hosts(self, entity_name, errata_id):
"""Check for search URI in Host Collection errata view.
Expand All @@ -141,21 +137,19 @@ def search_applicable_hosts(self, entity_name, errata_id):
return uri

def install_errata(
self, entity_name, errata_id, install_via='via Katello agent', job_values=None
self, entity_name, errata_id, install_via='via remote execution', job_values=None
):
"""Install host collection errata
:param str entity_name: The host collection name.
:param str errata_id: the errata id to install.
:param str install_via: Via which mean to install errata. Available
options: "via Katello Agent", "via remote execution",
"via remote execution - customize first"
options: "via remote execution", "via remote execution - customize first"
:param dict job_values: Remote Execution Job custom form values.
When install_via is: "via remote execution - customize first",
the new remote execution job form is opened and we can set custom
values.
:return: Task details view values when install "via kattelo agent" else
returns job status view values.
:return: Job status view values.
"""
if job_values is None:
job_values = {}
Expand All @@ -176,23 +170,18 @@ def install_errata(
job_create_view.fill(job_values)
job_create_view.submit.click()

if install_via == 'via Katello agent':
task_view = HostCollectionActionTaskDetailsView(view.browser)
task_view.progressbar.wait_for_result()
return task_view.read()
else:
# After this step the user is redirected to job status view.
job_status_view = JobInvocationStatusView(view.browser)
wait_for(
lambda: (
job_status_view.overview.job_status.read() != 'Pending'
and job_status_view.overview.job_status_progress.read() == '100%'
),
timeout=300,
delay=10,
logger=view.logger,
)
return job_status_view.overview.read()
# After this step the user is redirected to job status view.
job_status_view = JobInvocationStatusView(view.browser)
wait_for(
lambda: (
job_status_view.overview.job_status.read() != 'Pending'
and job_status_view.overview.job_status_progress.read() == '100%'
),
timeout=300,
delay=10,
logger=view.logger,
)
return job_status_view.overview.read()

def manage_module_streams(
self,
Expand Down
4 changes: 1 addition & 3 deletions airgun/views/contenthost.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@


class StatusIcon(GenericLocatorWidget):
"""Small icon indicating subscription or katello-agent status. Can be
colored in either green, yellow or red.
"""Small icon indicating subscription status. Can be colored in either green, yellow or red.
Example html representation::
Expand Down Expand Up @@ -142,7 +141,6 @@ class details(SatTab):
bios_uuid = ReadOnlyEntry(name='BIOS UUID')
description = EditableEntry(name='Description')
type = ReadOnlyEntry(name='Type')
katello_agent = ReadOnlyEntry(name='Katello Agent')
virtual_guests = ReadOnlyEntry(name='Virtual Guests')
registered_through = ReadOnlyEntry(name='Registered Through')
# Subscriptions
Expand Down
2 changes: 1 addition & 1 deletion airgun/views/hostcollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def get_action_button(self, name):
)
return action_button

def apply_action(self, name, action_via='via Katello Agent'):
def apply_action(self, name, action_via='via remote execution'):
"""Apply an action by name using action via if indicated"""
action_button = self.get_action_button(name)
action_button.fill(action_via)
Expand Down

0 comments on commit b626540

Please sign in to comment.