def manage_packages( self, entity_name, content_type='Package', packages=None, action='install', action_via='via Katello Agent', job_values=None, ): """Manage host collection packages. :param str entity_name: The host collection name. :param str content_type: The content type to apply action on. Available options: Package, Package Group. :param str packages: a list of packages separated by a space to apply the action on. :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" :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 values. """ if job_values is None: job_values = {} view = self.navigate_to(self, 'Edit', entity_name=entity_name) view.details.manage_packages.click() view = HostCollectionManagePackagesView(view.browser) if content_type is not None: view.content_type.fill(content_type) if packages is not None: view.packages.fill(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()
def install_errata(self, entity_name, errata_id, install_via='via Katello agent', 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" :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. """ if job_values is None: job_values = {} view = self.navigate_to(self, 'Edit', entity_name=entity_name) view.details.install_errata.click() view = HostCollectionInstallErrataView(view.browser) view.search.fill(errata_id) view.table.row(Id=errata_id)[0].widget.fill(True) view.install.fill(install_via) if view.dialog.is_displayed: view.dialog.confirm() view.flash.assert_no_error() view.flash.dismiss() if install_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 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()