Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove katello-agent from entities and views
Browse files Browse the repository at this point in the history
vsedmik committed Oct 13, 2023

Verified

This commit was signed with the committer’s verified signature.
piotrpio Piotr Piotrowski
1 parent 9f20721 commit b42a181
Showing 4 changed files with 25 additions and 52 deletions.
30 changes: 7 additions & 23 deletions airgun/entities/contenthost.py
Original file line number Diff line number Diff line change
@@ -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):
44 changes: 17 additions & 27 deletions airgun/entities/hostcollection.py
Original file line number Diff line number Diff line change
@@ -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.
@@ -141,21 +138,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 +171,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,
1 change: 0 additions & 1 deletion airgun/views/contenthost.py
Original file line number Diff line number Diff line change
@@ -142,7 +142,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
2 changes: 1 addition & 1 deletion airgun/views/hostcollection.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit b42a181

Please sign in to comment.