From 32f8dc492fbfbf16e030f6307e5a8a8657b54d5c Mon Sep 17 00:00:00 2001 From: Vladimir Sedmik Date: Fri, 13 Oct 2023 17:31:08 +0200 Subject: [PATCH] Remove katello-agent from entities and views --- airgun/entities/contenthost.py | 30 ++++---------- airgun/entities/hostcollection.py | 69 +++++++++++++------------------ airgun/views/contenthost.py | 4 +- airgun/views/hostcollection.py | 2 +- 4 files changed, 38 insertions(+), 67 deletions(-) diff --git a/airgun/entities/contenthost.py b/airgun/entities/contenthost.py index 8beaa66f3..0e35785e4 100644 --- a/airgun/entities/contenthost.py +++ b/airgun/entities/contenthost.py @@ -4,7 +4,6 @@ from airgun.views.contenthost import ( ContentHostDetailsView, ContentHostsView, - ContentHostTaskDetailsView, ErrataDetailsView, SyspurposeBulkActionView, ) @@ -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): @@ -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 @@ -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): diff --git a/airgun/entities/hostcollection.py b/airgun/entities/hostcollection.py index 597056d07..d9f411238 100644 --- a/airgun/entities/hostcollection.py +++ b/airgun/entities/hostcollection.py @@ -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. @@ -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 @@ -102,8 +101,6 @@ 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. @@ -111,19 +108,18 @@ def manage_packages( 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. @@ -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 = {} @@ -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, diff --git a/airgun/views/contenthost.py b/airgun/views/contenthost.py index 32b06541b..3e2a02c02 100644 --- a/airgun/views/contenthost.py +++ b/airgun/views/contenthost.py @@ -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:: @@ -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 diff --git a/airgun/views/hostcollection.py b/airgun/views/hostcollection.py index 98a875d61..3e8409fe5 100644 --- a/airgun/views/hostcollection.py +++ b/airgun/views/hostcollection.py @@ -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)