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()
def change_assigned_content(self, entity_name, lce, content_view): """Change host collection lifecycle environment and content view :param str entity_name: The host collection name. :param str lce: Lifecycle environment name. :param str content_view: Content view name. :return: task details view values """ view = self.navigate_to(self, 'Edit', entity_name=entity_name) view.details.change_assigned_content.click() view = HostCollectionChangeAssignedContentView(view.browser) view.lce.fill({lce: True}) view.content_view.fill(content_view) view.assign.click() view.dialog.confirm() view.flash.assert_no_error() view.flash.dismiss() task_view = HostCollectionActionTaskDetailsView(view.browser) task_view.progressbar.wait_for_result() return task_view.read()