From 4fbc3f9800567ed50ea0dde436825506743009db Mon Sep 17 00:00:00 2001 From: Mike Shriver Date: Thu, 4 Apr 2019 15:40:34 -0400 Subject: [PATCH] Remove 59z refs --- cfme/ansible/credentials.py | 7 +- cfme/ansible/repositories.py | 21 +- cfme/automate/explorer/common.py | 3 +- cfme/automate/explorer/klass.py | 6 +- cfme/automate/explorer/method.py | 7 +- cfme/base/login.py | 6 +- cfme/base/ui.py | 25 +- cfme/cloud/provider/gce.py | 12 +- cfme/cloud/provider/openstack.py | 6 +- cfme/cloud/security_groups.py | 4 - cfme/cloud/stack.py | 6 +- cfme/common/provider.py | 7 - cfme/common/provider_views.py | 50 ++-- cfme/common/vm.py | 111 +++---- cfme/common/vm_views.py | 6 +- cfme/configure/access_control/__init__.py | 91 ++---- .../configuration/diagnostics_settings.py | 36 ++- .../configuration/region_settings.py | 15 +- .../configuration/server_settings.py | 7 - cfme/configure/tasks.py | 4 +- cfme/containers/provider/__init__.py | 8 +- cfme/containers/provider/openshift.py | 40 +-- cfme/control/explorer/alert_profiles.py | 14 +- cfme/fixtures/appliance.py | 3 - cfme/fixtures/tag.py | 19 +- cfme/fixtures/ui_coverage.py | 54 +--- cfme/fixtures/v2v_fixtures.py | 40 +-- cfme/infrastructure/cluster.py | 32 +- cfme/infrastructure/datastore.py | 16 +- cfme/infrastructure/deployment_roles.py | 14 +- cfme/infrastructure/pxe.py | 10 +- cfme/infrastructure/resource_pool.py | 19 +- cfme/infrastructure/virtual_machines.py | 47 +-- cfme/intelligence/reports/dashboards.py | 42 +-- cfme/intelligence/reports/reports.py | 12 +- cfme/networks/subnet.py | 12 +- cfme/roles.py | 274 ------------------ cfme/scripting/appliance.py | 2 +- .../catalogs/catalog_items/__init__.py | 54 ++-- cfme/services/myservice/ui.py | 2 +- cfme/storage/manager.py | 10 +- cfme/storage/volume_backup.py | 2 +- .../ansible/test_embedded_ansible_actions.py | 28 +- .../ansible/test_embedded_ansible_automate.py | 79 ++--- .../ansible/test_embedded_ansible_basic.py | 2 - .../ansible/test_embedded_ansible_rest.py | 18 +- .../ansible/test_embedded_ansible_services.py | 17 +- .../ansible/test_embedded_ansible_tags.py | 26 +- .../automate/custom_button/test_buttons.py | 5 - .../custom_button/test_cloud_objects.py | 11 +- .../custom_button/test_generic_objects.py | 16 +- .../custom_button/test_import_export.py | 1 - .../custom_button/test_infra_objects.py | 2 - .../custom_button/test_service_objects.py | 16 +- cfme/tests/automate/test_common_methods.py | 5 +- cfme/tests/automate/test_git_import.py | 16 +- cfme/tests/automate/test_service_dialog.py | 8 +- cfme/tests/candu/test_azone_graph.py | 3 +- cfme/tests/candu/test_host_graph.py | 1 - cfme/tests/candu/test_utilization_metrics.py | 32 +- cfme/tests/candu/test_vm_graph.py | 3 +- cfme/tests/cli/test_appliance_cli.py | 13 - cfme/tests/cli/test_appliance_console.py | 71 +---- .../cli/test_appliance_console_db_restore.py | 24 +- cfme/tests/cli/test_appliance_update.py | 16 +- .../cloud/test_instance_power_control.py | 28 +- cfme/tests/cloud/test_providers.py | 77 +---- .../test_cloud_init_provisioning.py | 14 +- .../test_custom_attributes_rest.py | 59 ++-- .../test_policy_simulation.py | 2 +- .../cloud_infra_common/test_quota_manual.py | 6 +- .../cloud_infra_common/test_relationships.py | 26 +- .../cloud_infra_common/test_rest_providers.py | 31 +- .../cloud_infra_common/test_retirement.py | 19 +- .../cloud_infra_common/test_snapshots_rest.py | 5 - .../test_vm_instance_analysis.py | 13 +- cfme/tests/configure/test_access_control.py | 20 +- .../tests/configure/test_analysis_profiles.py | 1 - cfme/tests/configure/test_docs.py | 2 +- cfme/tests/configure/test_logs.py | 22 +- cfme/tests/configure/test_proxy.py | 42 ++- .../configure/test_register_appliance.py | 16 +- .../configure/test_remote_server_tabs.py | 1 - .../configure/test_rest_access_control.py | 54 +--- cfme/tests/configure/test_server_roles.py | 17 +- cfme/tests/configure/test_session_timeout.py | 6 +- cfme/tests/configure/test_tag.py | 1 - cfme/tests/configure/test_visual_infra.py | 1 - cfme/tests/configure/test_workers.py | 6 +- cfme/tests/configure/test_zones.py | 10 +- cfme/tests/containers/test_cockpit.py | 2 - .../test_containers_smartstate_analysis.py | 3 - ...ers_smartstate_analysis_multiple_images.py | 2 - .../test_overview_data_integrity.py | 6 +- .../containers/test_pause_resume_workers.py | 1 - .../test_project_quota_historical_data.py | 4 +- .../test_provider_openscap_policy_attached.py | 2 - cfme/tests/containers/test_reports.py | 9 +- ...sa_set_cve_image_inspector_per_provider.py | 3 - .../test_static_custom_attributes.py | 2 - cfme/tests/control/test_actions.py | 4 - cfme/tests/control/test_basic.py | 8 +- cfme/tests/control/test_bugs.py | 21 +- cfme/tests/control/test_default_alerts.py | 13 +- cfme/tests/control/test_rest_control.py | 8 +- .../test_config_management_rest.py | 18 +- .../infrastructure/test_datastore_analysis.py | 3 +- cfme/tests/infrastructure/test_host.py | 10 +- .../test_host_drift_analysis.py | 9 +- .../test_individual_host_creds.py | 39 +-- cfme/tests/infrastructure/test_providers.py | 16 +- .../test_provisioning_dialog.py | 10 +- .../infrastructure/test_provisioning_rest.py | 8 +- .../test_rest_automation_request.py | 6 +- .../infrastructure/test_rest_templates.py | 11 +- cfme/tests/infrastructure/test_snapshot.py | 16 +- cfme/tests/infrastructure/test_timelines.py | 7 +- .../tests/infrastructure/test_vm_ownership.py | 1 - .../infrastructure/test_vm_power_control.py | 23 +- cfme/tests/infrastructure/test_vm_rest.py | 5 +- .../infrastructure/test_webmks_console.py | 38 +-- .../test_aws_iam_auth_and_roles.py | 26 +- .../chargeback/test_resource_allocation.py | 5 - .../reports/test_canned_corresponds.py | 9 +- cfme/tests/intelligence/reports/test_crud.py | 26 +- .../reports/test_metering_report.py | 5 - .../reports/test_report_chargeback.py | 2 - .../reports/test_report_corresponds.py | 2 - .../reports/test_reports_schedules.py | 5 +- .../intelligence/reports/test_widgets.py | 1 - cfme/tests/intelligence/test_dashboard.py | 9 +- cfme/tests/networks/test_network_providers.py | 4 +- .../test_provision_to_virtual_network.py | 9 +- .../networks/test_sdn_inventory_collection.py | 7 +- cfme/tests/openstack/cloud/test_flavors.py | 12 +- cfme/tests/openstack/cloud/test_instances.py | 13 +- cfme/tests/openstack/cloud/test_keypairs.py | 1 - cfme/tests/openstack/cloud/test_provider.py | 4 - .../openstack/cloud/test_volume_backup.py | 1 - cfme/tests/openstack/cloud/test_volumes.py | 3 - cfme/tests/platform/test_advanced_config.py | 1 - cfme/tests/pod/test_appliance_crud.py | 15 +- cfme/tests/services/test_catalog_item.py | 2 +- .../services/test_cloud_service_catalogs.py | 5 - .../services/test_dynamicdd_dialogelement.py | 11 +- cfme/tests/services/test_myservice.py | 2 - cfme/tests/services/test_provision_stack.py | 22 +- cfme/tests/services/test_rest_services.py | 33 +-- cfme/tests/ssui/test_ssui_service_catalogs.py | 13 +- cfme/tests/storage/test_manager.py | 1 - cfme/tests/test_appliance.py | 48 +-- cfme/tests/test_db_migrate.py | 8 +- cfme/tests/test_db_migrate_manual.py | 67 +---- cfme/tests/test_login.py | 19 +- cfme/tests/test_manual.py | 36 +-- cfme/tests/test_rest.py | 47 +-- cfme/tests/test_rest_manual.py | 34 ++- .../v2v/test_v2v_migrations_single_vcenter.py | 1 - cfme/tests/v2v/test_v2v_migrations_ui.py | 6 +- cfme/tests/webui/test_advanced_search.py | 32 +- cfme/utils/appliance/__init__.py | 21 +- cfme/utils/appliance/db.py | 4 +- cfme/utils/template/template_upload.py | 2 +- 163 files changed, 853 insertions(+), 2077 deletions(-) diff --git a/cfme/ansible/credentials.py b/cfme/ansible/credentials.py index be159a4f57..e991b9d7e2 100644 --- a/cfme/ansible/credentials.py +++ b/cfme/ansible/credentials.py @@ -305,11 +305,8 @@ def update(self, updates): def delete(self): view = navigate_to(self, "Details") - if self.appliance.version < "5.9": - remove_str = "Remove this Credential" - else: - remove_str = "Remove this Credential from Inventory" - view.toolbar.configuration.item_select(remove_str, handle_alert=True) + view.toolbar.configuration.item_select("Remove this Credential from Inventory", + handle_alert=True) credentials_list_page = self.create_view(CredentialsListView) wait_for(lambda: False, silent_failure=True, timeout=5) assert credentials_list_page.is_displayed diff --git a/cfme/ansible/repositories.py b/cfme/ansible/repositories.py index 4422bbb1c3..d0f03a9db3 100644 --- a/cfme/ansible/repositories.py +++ b/cfme/ansible/repositories.py @@ -159,11 +159,8 @@ def update(self, updates): assert view.is_displayed view.flash.assert_no_error() if changed: - if self.appliance.version < "5.9": - msg = 'Edit of Repository "{}" was successfully initialized.' - else: - msg = 'Edit of Repository "{}" was successfully initiated.' - view.flash.assert_message(msg.format(updates.get("name", self.name))) + view.flash.assert_message('Edit of Repository "{}" was successfully initiated.' + .format(updates.get("name", self.name))) def _wait_until_changes_applied(): changed_updated_at = self.db_object.updated_at @@ -177,11 +174,8 @@ def _wait_until_changes_applied(): def delete(self): """Delete the repository in the UI.""" view = navigate_to(self, "Details") - if self.appliance.version < "5.9": - remove_str = "Remove this Repository" - else: - remove_str = "Remove this Repository from Inventory" - view.toolbar.configuration.item_select(remove_str, handle_alert=True) + view.toolbar.configuration.item_select("Remove this Repository from Inventory", + handle_alert=True) repo_list_page = self.create_view(RepositoryAllView) assert repo_list_page.is_displayed repo_list_page.flash.assert_no_error() @@ -239,11 +233,8 @@ def create(self, name, url, description=None, scm_credentials=None, scm_branch=N repo_list_page = self.create_view(RepositoryAllView) assert repo_list_page.is_displayed repo_list_page.flash.assert_no_error() - if self.appliance.version < "5.9.2": - initiated_message = 'Add of Repository "{}" was successfully initialized.'.format(name) - else: - initiated_message = 'Add of Repository "{}" was successfully initiated.'.format(name) - repo_list_page.flash.assert_message(initiated_message) + repo_list_page.flash.assert_message('Add of Repository "{}" was successfully initiated.' + .format(name)) repository = self.instantiate( name, diff --git a/cfme/automate/explorer/common.py b/cfme/automate/explorer/common.py index b7b489792e..c216f281c2 100644 --- a/cfme/automate/explorer/common.py +++ b/cfme/automate/explorer/common.py @@ -45,8 +45,7 @@ def copy_to(self, domain, new_name=None, replace=None, cancel=False): copy_page.copy_button.click() # Attention! Now we should be on a different page but the flash message is the same! copy_page.flash.assert_no_error() - if not BZ(1510463, forced_streams=['5.9']).blocks: - copy_page.flash.assert_message( + copy_page.flash.assert_message( 'Copy selected Automate {} was saved'.format(type(self).__name__)) else: copy_page.cancel_button.click() diff --git a/cfme/automate/explorer/klass.py b/cfme/automate/explorer/klass.py index 1c87f410ac..1945398a4d 100644 --- a/cfme/automate/explorer/klass.py +++ b/cfme/automate/explorer/klass.py @@ -269,10 +269,8 @@ def create(self, name=None, display_name=None, description=None, cancel=False): else: add_page.add_button.click() add_page.flash.assert_no_error() - if not BZ(1428424, forced_streams=['5.9']).blocks: - add_page.flash.assert_message( - 'Automate Class "/{}/{}" was added'.format( - '/'.join(self.tree_path[1:]), name)) + add_page.flash.assert_message('Automate Class "/{}/{}" was added' + .format('/'.join(self.tree_path[1:]), name)) return self.instantiate(name=name, display_name=display_name, description=description) def delete(self, *classes): diff --git a/cfme/automate/explorer/method.py b/cfme/automate/explorer/method.py index 5200f4db3f..a4b1c0b71a 100644 --- a/cfme/automate/explorer/method.py +++ b/cfme/automate/explorer/method.py @@ -387,10 +387,7 @@ def domain(self): @property def tree_path(self): - if self.appliance.version < '5.9': - icon_name_map = {'inline': 'product-method'} - else: - icon_name_map = {'inline': 'fa-ruby', 'playbook': 'vendor-ansible'} + icon_name_map = {'inline': 'fa-ruby', 'playbook': 'vendor-ansible'} if self.display_name: return self.parent_obj.tree_path + [ (icon_name_map[self.location], '{} ({})'.format(self.display_name, self.name))] @@ -467,7 +464,7 @@ def create( 'playbook_input_parameters': playbook_input_parameters }) validate = False - if validate and not BZ(1499881, forced_streams=['5.9']).blocks: + if validate: add_page.validate_button.click() add_page.wait_displayed() add_page.flash.assert_no_error() diff --git a/cfme/base/login.py b/cfme/base/login.py index b89fd9ce24..c3937b9e57 100644 --- a/cfme/base/login.py +++ b/cfme/base/login.py @@ -34,9 +34,6 @@ def change_group(self, group_name): User is required to be currently logged in """ - if self.extra.appliance.version < '5.9': - raise CFMEException("Changing the user group is not supported in versions < 5.9") - if not self.logged_in_as_user: raise CFMEException("Unable to change group when a user is not logged in") @@ -87,8 +84,7 @@ def group_names(self): """ Return a list of the logged in user's assigned groups. Returns: - Version >= 5.9 - list containing all groups the logged in user is assigned to - Version < 5.9 - single item list containing the user's current group + list containing all groups the logged in user is assigned to """ return [ diff --git a/cfme/base/ui.py b/cfme/base/ui.py index 7f3fa55666..0759d15dd7 100644 --- a/cfme/base/ui.py +++ b/cfme/base/ui.py @@ -66,7 +66,7 @@ def address(self): def prepare_server_name(name): # there is a bug in CF 5.10 UI when it has different number of spaces in different html attrs # this is temporary workaround until BZ(1668849) is fixed - if BZ(1668849, forced_streams=['5.9', '5.10']).blocks: + if BZ(1668849).blocks: new_name = re.escape(name) new_name = new_name.replace(r'\ ', r'\s*') new_name = re.compile(new_name) @@ -1025,8 +1025,6 @@ class advanced(WaitTab): # noqa company_tags = View.nested(CompanyTags) import_tags = View.nested(ImportTags) map_tags = View.nested(MapTags) - - # available starting from 5.9 version, not available in 5.7, 5.8 tags = View.nested(TagsView) @property @@ -1097,10 +1095,7 @@ def am_i_here(self): return False def step(self, *args, **kwargs): - if self.obj.appliance.version < '5.9': - self.prerequisite_view.import_tags.select() - else: - self.prerequisite_view.tags.import_tags.select() + self.prerequisite_view.tags.import_tags.select() @navigator.register(Region) @@ -1112,10 +1107,7 @@ def am_i_here(self): return False def step(self, *args, **kwargs): - if self.obj.appliance.version < '5.9': - self.prerequisite_view.imports.select() - else: - self.prerequisite_view.tags.imports.select() + self.prerequisite_view.tags.imports.select() @navigator.register(Region) @@ -1717,14 +1709,11 @@ class import_git(View): # noqa @property def is_displayed(self): - # TODO: Remove check if the fix for BZ 1686054 is back ported to 5.9z - if self.browser.product_version < "5.10": - title = "Reset all components in the following domains: ManageIQ" - else: - title = "Reset all components in the following domains: RedHat, ManageIQ" + title = "Reset all components in the following domains: RedHat, ManageIQ" - return (self.in_import_export and self.export_all.is_displayed and self.reset_title.text - == title) + return (self.in_import_export and + self.export_all.is_displayed and + self.reset_title.text == title) @navigator.register(Server) diff --git a/cfme/cloud/provider/gce.py b/cfme/cloud/provider/gce.py index 20110f8bfa..9c1308158e 100644 --- a/cfme/cloud/provider/gce.py +++ b/cfme/cloud/provider/gce.py @@ -45,21 +45,17 @@ class GCEProvider(CloudProvider): settings_key = 'ems_google' project = attr.ib(default=None) - region = attr.ib(default=None) - region_name = attr.ib(default=None) + region = attr.ib(default=None) # deprecated in 5.9.2 + region_name = attr.ib(default=None) # deprecated in 5.9.2 @property def view_value_mapping(self): endpoints = { 'name': self.name, 'prov_type': 'Google Compute Engine', - 'region': self.region_name, 'project_id': self.project } - if self.appliance.version >= '5.9.2': - # from 5.9.2 we are not supporting region selection for GCE - del endpoints['region'] return endpoints @classmethod @@ -70,8 +66,8 @@ def from_config(cls, prov_config, prov_key): name=prov_config['name'], project=prov_config['project'], zone=prov_config['zone'], - region=prov_config['region'], - region_name=prov_config['region_name'], + region=prov_config.get('region'), + region_name=prov_config.get('region_name'), endpoints={endpoint.name: endpoint}, key=prov_key) diff --git a/cfme/cloud/provider/openstack.py b/cfme/cloud/provider/openstack.py index 655bfc2b7a..9de0dafaab 100644 --- a/cfme/cloud/provider/openstack.py +++ b/cfme/cloud/provider/openstack.py @@ -91,11 +91,7 @@ def from_config(cls, prov_config, prov_key): event_endpoint_config = prov_config['endpoints'].get(EventsEndpoint.name, {}) if event_endpoint_config: - if (event_endpoint_config.get('event_stream') == 'AMQP' and - BZ(1618700, forced_streams=["5.9", "5.10", "upstream"]).blocks): - logger.warning('Skipping AMQP event config due to BZ 1618700') - else: - endpoints[EventsEndpoint.name] = EventsEndpoint(**event_endpoint_config) + endpoints[EventsEndpoint.name] = EventsEndpoint(**event_endpoint_config) rsa_endpoint_config = prov_config['endpoints'].get(SSHEndpoint.name, {}) if rsa_endpoint_config: diff --git a/cfme/cloud/security_groups.py b/cfme/cloud/security_groups.py index 00d30cd9d4..9359c3dbd2 100644 --- a/cfme/cloud/security_groups.py +++ b/cfme/cloud/security_groups.py @@ -243,8 +243,4 @@ class Add(CFMENavigateStep): def step(self, *args, **kwargs): """Raises DropdownItemDisabled from widgetastic_patternfly if no RHOS Network manager present""" - # Todo remove when fixed 1520669 - if (BZ(1520669, forced_streams='5.9').blocks and - self.prerequisite_view.flash.messages): - self.prerequisite_view.flash.dismiss() self.prerequisite_view.toolbar.configuration.item_select('Add a new Security Group') diff --git a/cfme/cloud/stack.py b/cfme/cloud/stack.py index ba1b0572bc..16de214b33 100644 --- a/cfme/cloud/stack.py +++ b/cfme/cloud/stack.py @@ -265,10 +265,8 @@ def exists(self): def delete(self): """Delete the stack from detail view""" view = navigate_to(self, 'Details') - msg = 'Remove this Orchestration Stack' - if self.appliance.version >= '5.9': - msg = 'Remove this Orchestration Stack from Inventory' - view.toolbar.configuration.item_select(msg, handle_alert=True) + view.toolbar.configuration.item_select('Remove this Orchestration Stack from Inventory', + handle_alert=True) view.flash.assert_success_message('The selected Orchestration Stacks was deleted') def refresh(): diff --git a/cfme/common/provider.py b/cfme/common/provider.py index 6208fea8f9..c3d3e01d13 100644 --- a/cfme/common/provider.py +++ b/cfme/common/provider.py @@ -196,13 +196,6 @@ def create(self, cancel=False, validate_credentials=True, check_existing=False, add_view = navigate_to(self, 'Add') if not cancel or (cancel and any(self.view_value_mapping.values())): - # Workaround for BZ#1526050 - from cfme.infrastructure.provider.virtualcenter import VMwareProvider - if self.appliance.version == '5.8.3.0' and self.one_of(VMwareProvider): - add_view.fill({'prov_type': 'Red Hat Virtualization'}) - elif '5.8.3.0' < self.appliance.version < '5.9': - import warnings - warnings.warn('REMOVE ME: BZ#1526050') # filling main part of dialog add_view.fill(self.view_value_mapping) diff --git a/cfme/common/provider_views.py b/cfme/common/provider_views.py index e09c1409c2..79c60001e2 100644 --- a/cfme/common/provider_views.py +++ b/cfme/common/provider_views.py @@ -464,9 +464,9 @@ def is_displayed(self): self.title.text == 'Add New Cloud Provider') -class ContainerProviderSettingView(ProvidersView): +class ContainerProviderSettingView(View): """ - Settings view for builds 5.9 and up + Settings view for Container Providers """ @View.nested @@ -490,26 +490,15 @@ class advanced(WaitTab, BeforeFillMixin): # NOQA class ContainerProviderAddView(ProviderAddView): """ - represents Container Provider Add View - """ - prov_type = BootstrapSelect(id='ems_type') - - @property - def is_displayed(self): - return (super(ProviderAddView, self).is_displayed and - self.navigation.currently_selected == ['Compute', 'Containers', 'Providers'] and - self.title.text == 'Add New Containers Provider') - - -class ContainerProviderAddViewUpdated(ContainerProviderAddView, ContainerProviderSettingView): - """ - Additional widgets for builds 5.9 and up + Additional widgets for Container """ COND_WIDGETS = ['prov_type', 'metrics_type', 'alerts_type', 'virt_type'] + prov_type = BootstrapSelect(id='ems_type') metrics_type = BootstrapSelect(id='metrics_selection') alerts_type = BootstrapSelect(id='alerts_selection') virt_type = BootstrapSelect(id='virtualization_selection') + included_settings = View.include(ContainerProviderSettingView, use_parent=True) def before_fill(self, values): for widget_name in self.COND_WIDGETS: @@ -517,6 +506,12 @@ def before_fill(self, values): if widget.is_displayed: widget.fill(values.get(widget_name) or 'Disabled') + @property + def is_displayed(self): + return (super(ProviderAddView, self).is_displayed and + self.navigation.currently_selected == ['Compute', 'Containers', 'Providers'] and + self.title.text == 'Add New Containers Provider') + class PhysicalProviderAddView(ProviderAddView): """ @@ -547,19 +542,21 @@ class ProviderEditView(ProviderAddView): @property def is_displayed(self): provider_obj = self.context['object'] - expected_title = ("Edit {type} Providers '{name}'".format( - type=provider_obj.string_name, name=provider_obj.name)) + expected_title = "Edit {type} Providers '{name}'".format(type=provider_obj.string_name, + name=provider_obj.name) - return (self.logged_in_as_current_user and - self.title.text == expected_title and - self.navigation.currently_selected == [ - 'Compute', - ('Clouds' if provider_obj.string_name == "Cloud" else provider_obj.string_name), - 'Providers' - ]) + return ( + self.logged_in_as_current_user and + self.title.text == expected_title and + self.navigation.currently_selected == [ + 'Compute', + ('Clouds' if provider_obj.string_name == "Cloud" else provider_obj.string_name), + 'Providers' + ] + ) -class ContainerProviderEditViewUpdated(ProviderEditView, ContainerProviderSettingView): +class ContainerProviderEditView(ProviderEditView): """ Additional widgets for builds 5.9 and up """ @@ -569,6 +566,7 @@ class ContainerProviderEditViewUpdated(ProviderEditView, ContainerProviderSettin metrics_type = BootstrapSelect(id='metrics_selection') alerts_type = BootstrapSelect(id='alerts_selection') virt_type = BootstrapSelect(id='virtualization_selection') + included_settings = View.include(ContainerProviderSettingView, use_parent=True) def before_fill(self, values): for widget in self.COND_WIDGETS: diff --git a/cfme/common/vm.py b/cfme/common/vm.py index ce143ac744..27bb269d2e 100644 --- a/cfme/common/vm.py +++ b/cfme/common/vm.py @@ -839,7 +839,6 @@ def set_retirement_date(self, when=None, offset=None, warn=None): An enhancement to cfme.utils.timeutil extending timedelta would be great for making this a bit cleaner """ - new_retire = self.appliance.version >= "5.9" view = navigate_to(self, 'SetRetirement') fill_date = None fill_offset = None @@ -848,8 +847,6 @@ def set_retirement_date(self, when=None, offset=None, warn=None): if when is not None and offset is not None: raise ValueError('set_retirement_date takes when or offset, but not both') - if not new_retire and offset is not None: - raise ValueError('Offset retirement only available in CFME 59z+ or miq-gaprindashvili') if when is not None and not isinstance(when, (datetime, date)): raise ValueError('when argument must be a datetime object') @@ -862,70 +859,50 @@ def set_retirement_date(self, when=None, offset=None, warn=None): # format the date # needs 4 digit year for fill # displayed 2 digit year for flash message - if new_retire: - # 59z/G-release retirement - if when is not None and offset is None: - # Specific datetime retire, H+M are 00:00 by default if just date passed - fill_date = when.strftime('%m/%d/%Y %H:%M') # 4 digit year - msg_date = when.strftime('%m/%d/%y %H:%M UTC') # two digit year and timestamp - msg = 'Retirement date set to {}'.format(msg_date) - elif when is None and offset is None: - # clearing retirement date with space in textinput, - # using space here as with empty string calendar input is not cleared correctly - fill_date = ' ' - msg = 'Retirement date removed' - elif offset is not None: - # retirement by offset - fill_date = None - fill_offset = {k: v for k, v in offset.items() if k in ['months', - 'weeks', - 'days', - 'hours']} - # hack together an offset - # timedelta can take weeks, but not months - # copy and pop, only used to generate message, not used for form fill - offset_copy = fill_offset.copy() - if 'months' in offset_copy: - new_weeks = offset_copy.get('weeks', 0) + int(offset_copy.pop('months', 0)) * 4 - offset_copy.update({'weeks': new_weeks}) - - msg_date = datetime.utcnow() + timedelta(**offset_copy) - msg = 'Retirement date set to {}'.format(msg_date.strftime('%m/%d/%y %H:%M UTC')) - # TODO move into before_fill when no need to click away from datetime picker - view.form.fill({ - 'retirement_mode': - 'Time Delay from Now' if fill_offset else 'Specific Date and Time'}) - view.flush_widget_cache() # since retirement_date is conditional widget - if fill_date is not None: # specific check because of empty string - # two part fill, widget seems to block warn selection when open - changed_date = view.form.fill({ - 'retirement_date': {'datetime_select': fill_date}}) - view.title.click() # close datetime widget - changed_warn = view.form.fill({'retirement_warning': warn}) - changed = changed_date or changed_warn - elif fill_offset: - changed = view.form.fill({ - 'retirement_date': fill_offset, 'retirement_warning': warn}) - - else: - # 58z/euwe retirement - if when: - fill_date = when.strftime('%m/%d/%Y') # 4 digit year - msg_date = when.strftime('%m/%d/%y 00:00 UTC') # two digit year and default 0 UTC - msg = 'Retirement date set to {}'.format(msg_date) - else: - fill_date = None - msg = 'Retirement date removed' - if fill_date: - changed = view.form.fill({'retirement_date': fill_date, 'retirement_warning': warn}) - else: - if view.form.remove_date.is_displayed: - view.form.remove_date.click() - changed = True - else: - # no date set, nothing to change - logger.info('Retirement date not set, cannot clear, canceling form') - changed = False + # 59z/G-release retirement + changed = False # just in case it isn't set in logic + if when is not None and offset is None: + # Specific datetime retire, H+M are 00:00 by default if just date passed + fill_date = when.strftime('%m/%d/%Y %H:%M') # 4 digit year + msg_date = when.strftime('%m/%d/%y %H:%M UTC') # two digit year and timestamp + msg = 'Retirement date set to {}'.format(msg_date) + elif when is None and offset is None: + # clearing retirement date with space in textinput, + # using space here as with empty string calendar input is not cleared correctly + fill_date = ' ' + msg = 'Retirement date removed' + elif offset is not None: + # retirement by offset + fill_date = None + fill_offset = {k: v for k, v in offset.items() if k in ['months', + 'weeks', + 'days', + 'hours']} + # hack together an offset + # timedelta can take weeks, but not months + # copy and pop, only used to generate message, not used for form fill + offset_copy = fill_offset.copy() + if 'months' in offset_copy: + new_weeks = offset_copy.get('weeks', 0) + int(offset_copy.pop('months', 0)) * 4 + offset_copy.update({'weeks': new_weeks}) + + msg_date = datetime.utcnow() + timedelta(**offset_copy) + msg = 'Retirement date set to {}'.format(msg_date.strftime('%m/%d/%y %H:%M UTC')) + # TODO move into before_fill when no need to click away from datetime picker + view.form.fill({ + 'retirement_mode': + 'Time Delay from Now' if fill_offset else 'Specific Date and Time'}) + view.flush_widget_cache() # since retirement_date is conditional widget + if fill_date is not None: # specific check because of empty string + # two part fill, widget seems to block warn selection when open + changed_date = view.form.fill({ + 'retirement_date': {'datetime_select': fill_date}}) + view.title.click() # close datetime widget + changed_warn = view.form.fill({'retirement_warning': warn}) + changed = changed_date or changed_warn + elif fill_offset: + changed = view.form.fill({ + 'retirement_date': fill_offset, 'retirement_warning': warn}) # Form save and flash messages are the same between versions if changed: diff --git a/cfme/common/vm_views.py b/cfme/common/vm_views.py index 44b0bd4f75..530e7c5de9 100644 --- a/cfme/common/vm_views.py +++ b/cfme/common/vm_views.py @@ -168,13 +168,9 @@ class HostAllVMsView(BaseLoggedInPage): @property def is_displayed(self): - if self.browser.product_version < "5.9": - title = "{} (All VMs)".format(self.context["object"].name) - else: - title = "{} (All Direct VMs)".format(self.context["object"].name) return ( self.navigation.currently_selected == ["Compute", "Infrastructure", "Hosts"] and - self.title.text == title + self.title.text == "{} (All Direct VMs)".format(self.context["object"].name) ) diff --git a/cfme/configure/access_control/__init__.py b/cfme/configure/access_control/__init__.py index bda36393ba..270dd1a6de 100644 --- a/cfme/configure/access_control/__init__.py +++ b/cfme/configure/access_control/__init__.py @@ -344,10 +344,6 @@ def create(self, name=None, credential=None, email=None, groups=None, cost_cente if type(groups) is not list: groups = [groups] - if self.appliance.version < "5.9" and len(groups) > 1: - raise CFMEException( - "Assigning a user to multiple groups is only supported in CFME versions > 5.8") - user = self.instantiate( name=name, credential=credential, email=email, groups=groups, cost_center=cost_center, value_assign=value_assign @@ -757,12 +753,7 @@ def set_group_order(self, updated_order): Args: updated_order: group order list """ - if self.appliance.version < "5.9.2": - name_column = "Name" - else: - name_column = "Description" - - find_row_kwargs = {name_column: self.description} + find_row_kwargs = {"Description": self.description} view = navigate_to(self.parent, 'All') row = view.paginator.find_row_on_pages(view.table, **find_row_kwargs) original_sequence = row.sequence.text @@ -1069,17 +1060,9 @@ def update(self, updates): else: view.cancel_button.click() flash_message = 'Edit of Role was cancelled by the user' - view = self.create_view(DetailsRoleView, override=updates) + view = self.create_view(DetailsRoleView, override=updates, wait=10) view.flash.assert_message(flash_message) - # Typically this would be a safe check but BZ 1561698 will sometimes cause the accordion - # to fail to update the role name w/o a manual refresh causing is_displayed to fail - # Instead of inserting a blind refresh, just disable this until the bug is resolved since - # it's a good check for accordion UI failures - # See BZ https://bugzilla.redhat.com/show_bug.cgi?id=1561698 - if not BZ(1561698, forced_streams=['5.9']).blocks: - assert view.is_displayed - def delete(self, cancel=True): """ Delete existing role @@ -1112,11 +1095,10 @@ def delete(self, cancel=True): view.flash.assert_message(flash_success_msg) if cancel: - view = self.create_view(AllRolesView) + view = self.create_view(AllRolesView, wait=10) # implicit assert view.flash.assert_success_message(flash_success_msg) else: - view = self.create_view(DetailsRoleView) - assert view.is_displayed + view = self.create_view(DetailsRoleView, wait=10) # implicit assert def copy(self, name=None): """ Creates copy of existing role @@ -1127,16 +1109,16 @@ def copy(self, name=None): name = "{}_copy".format(self.name) view = navigate_to(self, 'Details') view.toolbar.configuration.item_select('Copy this Role to a new Role') - view = self.create_view(AddRoleView) + view = self.create_view(AddRoleView, wait=10) # implicit assert new_role = self.parent.instantiate(name=name) view.fill({'name_txt': new_role.name}) view.add_button.click() - view = self.create_view(AllRolesView) + view = self.create_view(AllRolesView, wait=10) # implicit assert view.flash.assert_success_message('Role "{}" was saved'.format(new_role.name)) - assert view.is_displayed return new_role - def set_role_product_features(self, view, product_features): + @staticmethod + def set_role_product_features(view, product_features): """ Sets product features for role restriction Args: @@ -1164,6 +1146,9 @@ def create(self, name=None, vm_restriction=None, product_features=None, cancel=F """ Create role method Args: + name: string name of the role + vm_restriction: restriction used for role + product_features: product feature to select cancel: True - if you want to cancel role creation, by default, role will be created @@ -1188,7 +1173,7 @@ def create(self, name=None, vm_restriction=None, product_features=None, cancel=F else: view.add_button.click() flash_message = 'Role "{}" was saved'.format(role.name) - view = self.create_view(AllRolesView) + view = self.create_view(AllRolesView, wait=10) # implicit assert try: view.flash.assert_message(flash_blocked_msg) @@ -1198,8 +1183,6 @@ def create(self, name=None, vm_restriction=None, product_features=None, cancel=F view.flash.assert_success_message(flash_message) - assert view.is_displayed - return role @@ -1228,9 +1211,11 @@ class RoleDetails(CFMENavigateStep): prerequisite = NavigateToAttribute('parent', 'All') def step(self, *args, **kwargs): - self.prerequisite_view.browser.refresh() # workaround for 5.9 issue of role now shown self.prerequisite_view.accordions.accesscontrol.tree.click_path( - self.obj.appliance.server_region_string(), 'Roles', self.obj.name) + self.obj.appliance.server_region_string(), + 'Roles', + self.obj.name + ) @navigator.register(Role, 'Edit') @@ -1393,21 +1378,14 @@ def update(self, updates): """ view = navigate_to(self, 'Edit') changed = view.form.fill(updates) + new_name = updates.get('name', self.name) if changed: view.save_button.click() - if self.appliance.version < '5.9': - flash_message = 'Project "{}" was saved'.format(updates.get('name', self.name)) - else: - flash_message = '{} "{}" has been successfully saved.'.format( - self.obj_type, updates.get('name', self.name)) + flash_message = '{} "{}" has been successfully saved.'.format(self.obj_type, new_name) else: view.cancel_button.click() - if self.appliance.version < '5.9': - flash_message = 'Edit of Project "{}" was cancelled by the user'.format( - updates.get('name', self.name)) - else: - flash_message = 'Edit of {} "{}" was canceled by the user.'.format( - self.obj_type, updates.get('name', self.name)) + flash_message = ('Edit of {} "{}" was canceled by the user.' + .format(self.obj_type, new_name)) view = self.create_view(DetailsTenantView, override=updates) view.flash.assert_message(flash_message) @@ -1447,11 +1425,10 @@ def set_quota(self, **kwargs): expected_msg = 'Quotas for {} "{}" were saved'.format(self.obj_type, self.name) else: view.cancel_button.click() - expected_msg = 'Manage quotas for {} "{}" was cancelled by the user'\ - .format(self.obj_type, self.name) - view = self.create_view(DetailsTenantView) + expected_msg = ('Manage quotas for {} "{}" was cancelled by the user' + .format(self.obj_type, self.name)) + view = self.create_view(DetailsTenantView, wait=10) # implicit assert view.flash.assert_success_message(expected_msg) - assert view.is_displayed @property def quota(self): @@ -1503,17 +1480,11 @@ def get_root_tenant(self): default=True) def create(self, name, description, parent): - if self.appliance.version > '5.9': - tenant_success_flash_msg = 'Tenant "{}" has been successfully added.' - else: - tenant_success_flash_msg = 'Tenant "{}" was saved' - tenant = self.instantiate(name, description, parent) view = navigate_to(tenant.parent_tenant, 'Details') view.toolbar.configuration.item_select('Add child Tenant to this Tenant') - view = self.create_view(AddTenantView) - wait_for(lambda: view.is_displayed, timeout=5) + view = self.create_view(AddTenantView, wait=5) changed = view.form.fill({'name': name, 'description': description}) if changed: @@ -1522,9 +1493,7 @@ def create(self, name, description, parent): view.form.cancel_button.click() view = self.create_view(ParentDetailsTenantView) - - view.flash.assert_success_message(tenant_success_flash_msg.format(name)) - + view.flash.assert_success_message('Tenant "{}" has been successfully added.'.format(name)) return tenant def delete(self, *tenants): @@ -1611,18 +1580,12 @@ def get_root_tenant(self): name=str(self.appliance.rest_api.collections.tenants[0].name), default=True) def create(self, name, description, parent): - if self.appliance.version > '5.9': - project_success_flash_msg = 'Project "{}" has been successfully added.' - else: - project_success_flash_msg = 'Project "{}" was saved' - project = self.instantiate(name, description, parent) view = navigate_to(project.parent_tenant, 'Details') view.toolbar.configuration.item_select('Add Project to this Tenant') - view = self.create_view(AddTenantView) - wait_for(lambda: view.is_displayed, timeout=5) + view = self.create_view(AddTenantView, wait=5) changed = view.form.fill({'name': name, 'description': description}) if changed: @@ -1631,7 +1594,7 @@ def create(self, name, description, parent): view.form.cancel_button.click() view = self.create_view(ParentDetailsTenantView) - view.flash.assert_success_message(project_success_flash_msg.format(name)) + view.flash.assert_success_message('Project "{}" has been successfully added.'.format(name)) return project diff --git a/cfme/configure/configuration/diagnostics_settings.py b/cfme/configure/configuration/diagnostics_settings.py index 350a8728fe..b713f230d7 100644 --- a/cfme/configure/configuration/diagnostics_settings.py +++ b/cfme/configure/configuration/diagnostics_settings.py @@ -82,10 +82,7 @@ def reload_worker(self, pid=None): # Initiate the restart for pid_item in pid: row = view.workers_table.row(pid=pid_item) - if self.appliance.version >= '5.9': - row[0].check(), - else: - row.click() + row[0].check() view.toolbar.configuration.item_select("Restart selected worker", handle_alert=True) return pid @@ -192,20 +189,27 @@ def update(self, updates, cancel=False, reset=False): updated = view.fill({'depot_type': depot_type}) fill_dict = {} if depot_type != 'Red Hat Dropbox': - fill_dict.update({'depot_info': { - 'depot_name': updates.get('depot_name'), - 'uri': updates.get('uri')} - }) + fill_dict.update( + { + 'depot_info': + { + 'depot_name': updates.get('depot_name'), + 'uri': updates.get('uri') + } + } + ) else: # all data is filled automatically for Red Hat Dropbox depot type updated = True if depot_type in ['FTP', 'Samba']: - fill_dict.update({'depot_creds': { - 'username': updates.get('username'), - 'password': updates.get('password') - } - }) - if self.appliance.version < '5.9': - fill_dict['depot_creds']['confirm_password'] = updates.get('password') + fill_dict.update( + { + 'depot_creds': + { + 'username': updates.get('username'), + 'password': updates.get('password') + } + } + ) updated = view.fill(fill_dict) or updated try: view.depot_creds.validate_button.click() @@ -226,7 +230,7 @@ def update(self, updates, cancel=False, reset=False): flash_message = "Log Depot Settings were saved" else: logger.info('Settings were not updated') - view = self.create_view(flash_view) + view = self.create_view(flash_view, wait=10) # implicit assert view.flash.assert_message(flash_message) @property diff --git a/cfme/configure/configuration/region_settings.py b/cfme/configure/configuration/region_settings.py index be9f1fd92c..188b513929 100644 --- a/cfme/configure/configuration/region_settings.py +++ b/cfme/configure/configuration/region_settings.py @@ -131,10 +131,7 @@ class TagsAll(CFMENavigateStep): prerequisite = NavigateToAttribute('appliance.server.zone.region', 'Details') def step(self, *args, **kwargs): - if self.obj.appliance.version < '5.9': - self.prerequisite_view.company_tags.select() - else: - self.prerequisite_view.tags.company_tags.select() + self.prerequisite_view.tags.company_tags.select() self.view.fill({'category_dropdown': self.obj.parent.display_name}) @@ -318,10 +315,7 @@ class CategoryAll(CFMENavigateStep): prerequisite = NavigateToAttribute('appliance.server.zone.region', 'Details') def step(self, *args, **kwargs): - if self.obj.appliance.version < '5.9': - self.prerequisite_view.company_categories.select() - else: - self.prerequisite_view.tags.company_categories.select() + self.prerequisite_view.tags.company_categories.select() @navigator.register(CategoriesCollection, 'Add') @@ -489,10 +483,7 @@ class MapTagsAll(CFMENavigateStep): prerequisite = NavigateToAttribute('appliance.server.zone.region', 'Details') def step(self, *args, **kwargs): - if self.obj.appliance.version < '5.9': - self.prerequisite_view.map_tags.select() - else: - self.prerequisite_view.tags.map_tags.select() + self.prerequisite_view.tags.map_tags.select() @navigator.register(MapTagsCollection, 'Add') diff --git a/cfme/configure/configuration/server_settings.py b/cfme/configure/configuration/server_settings.py index 614d725482..0dbb96b6c5 100644 --- a/cfme/configure/configuration/server_settings.py +++ b/cfme/configure/configuration/server_settings.py @@ -273,13 +273,6 @@ def update_server_roles_ui(self, updates, reset=False): """ view = navigate_to(self.appliance.server, 'Server') - # embedded_ansible server role available from 5.8 version - if self.appliance.version < '5.8' and 'embedded_ansible' in updates: - updates.pop('embedded_ansible') - - # cockpit_ws element introduced in 5.9 version - if self.appliance.version < 5.9 and 'cockpit_ws' in updates: - updates.pop('cockpit_ws') updated = view.server_roles.fill(updates) self._save_action(view, updated, reset) diff --git a/cfme/configure/tasks.py b/cfme/configure/tasks.py index 649a90dffc..c469b4078b 100644 --- a/cfme/configure/tasks.py +++ b/cfme/configure/tasks.py @@ -142,9 +142,7 @@ def started(self): @property def queued(self): - if self.appliance.version >= '5.9': - return self._row.queued.text - return None + return self._row.queued.text @property def message(self): diff --git a/cfme/containers/provider/__init__.py b/cfme/containers/provider/__init__.py index 20b9603fc9..81b390e6f1 100644 --- a/cfme/containers/provider/__init__.py +++ b/cfme/containers/provider/__init__.py @@ -29,8 +29,8 @@ from cfme.common.provider import DefaultEndpointForm from cfme.common.provider import provider_types from cfme.common.provider_views import BeforeFillMixin -from cfme.common.provider_views import ContainerProviderAddViewUpdated -from cfme.common.provider_views import ContainerProviderEditViewUpdated +from cfme.common.provider_views import ContainerProviderAddView +from cfme.common.provider_views import ContainerProviderEditView from cfme.common.provider_views import ContainerProvidersView from cfme.common.provider_views import ProviderDetailsToolBar from cfme.common.provider_views import ProviderDetailsView @@ -419,7 +419,7 @@ def resetter(self, *args, **kwargs): @navigator.register(ContainersProviderCollection, 'Add') @navigator.register(ContainersProvider, 'Add') class Add(CFMENavigateStep): - VIEW = ContainerProviderAddViewUpdated + VIEW = ContainerProviderAddView prerequisite = NavigateToSibling('All') def step(self, *args, **kwargs): @@ -449,7 +449,7 @@ def resetter(self, *args, **kwargs): @navigator.register(ContainersProvider, 'Edit') class Edit(CFMENavigateStep): - VIEW = ContainerProviderEditViewUpdated + VIEW = ContainerProviderEditView prerequisite = NavigateToSibling('All') def step(self, *args, **kwargs): diff --git a/cfme/containers/provider/openshift.py b/cfme/containers/provider/openshift.py index 61f61cd3c8..65cc1ad5ce 100644 --- a/cfme/containers/provider/openshift.py +++ b/cfme/containers/provider/openshift.py @@ -112,7 +112,7 @@ def create(self, **kwargs): # Enable alerts collection before adding the provider to avoid missing active # alert after adding the provider # For more info: https://bugzilla.redhat.com/show_bug.cgi?id=1514950 - if self.appliance.version >= '5.9' and getattr(self, "alerts_type") == "Prometheus": + if getattr(self, "alerts_type") == "Prometheus": alert_profiles = self.appliance.collections.alert_profiles provider_profile = alert_profiles.instantiate(ProviderAlertProfile, "Prometheus Provider Profile") @@ -139,29 +139,21 @@ def view_value_mapping(self): 'prov_type': ('OpenShift Container Platform' if self.appliance.is_downstream else 'OpenShift')} - if self.appliance.version >= '5.9': - mapping['metrics_type'] = self.metrics_type - mapping['alerts_type'] = self.alerts_type - mapping['proxy'] = { - 'http_proxy': self.http_proxy - } - mapping['advanced'] = { - 'adv_http': self.adv_http, - 'adv_https': self.adv_https, - 'no_proxy': self.no_proxy, - 'image_repo': self.image_repo, - 'image_reg': self.image_reg, - 'image_tag': self.image_tag, - 'cve_loc': self.cve_loc - } - if self.appliance.version >= '5.10': - mapping['virt_type'] = self.virt_type - else: - mapping['metrics_type'] = None - mapping['alerts_type'] = None - mapping['virt_type'] = None - mapping['proxy'] = None - mapping['advanced'] = None + mapping['metrics_type'] = self.metrics_type + mapping['alerts_type'] = self.alerts_type + mapping['proxy'] = { + 'http_proxy': self.http_proxy + } + mapping['advanced'] = { + 'adv_http': self.adv_http, + 'adv_https': self.adv_https, + 'no_proxy': self.no_proxy, + 'image_repo': self.image_repo, + 'image_reg': self.image_reg, + 'image_tag': self.image_tag, + 'cve_loc': self.cve_loc + } + mapping['virt_type'] = self.virt_type return mapping diff --git a/cfme/control/explorer/alert_profiles.py b/cfme/control/explorer/alert_profiles.py index b7946daec3..7992e1265a 100644 --- a/cfme/control/explorer/alert_profiles.py +++ b/cfme/control/explorer/alert_profiles.py @@ -277,40 +277,28 @@ def step(self, *args, **kwargs): class ClusterAlertProfile(BaseAlertProfile): - TYPE = "Cluster / Deployment Role" class DatastoreAlertProfile(BaseAlertProfile): - TYPE = "Datastore" class HostAlertProfile(BaseAlertProfile): - TYPE = "Host / Node" class ProviderAlertProfile(BaseAlertProfile): - TYPE = "Provider" class ServerAlertProfile(BaseAlertProfile): - TYPE = "Server" class VMInstanceAlertProfile(BaseAlertProfile): - TYPE = "VM and Instance" class NodeAlertProfile(BaseAlertProfile): - - @property - def TYPE(self): # noqa - if self.appliance.version < "5.9.2": - return "Node" - else: - return "Container Node" + TYPE = "Container Node" diff --git a/cfme/fixtures/appliance.py b/cfme/fixtures/appliance.py index 195690e34c..bd67eacc99 100644 --- a/cfme/fixtures/appliance.py +++ b/cfme/fixtures/appliance.py @@ -195,9 +195,6 @@ def get_vddk_url(provider): major = str(provider.version) minor = "0" vddk_version = "v{}_{}".format(major, minor) - # cf. BZ 1651702 vddk_version 6_7 does not currently work with CFME, so use v6_5 - if BZ(1651702, forced_streams=['5.9', '5.10']).blocks: - vddk_version = "v6_5" try: url = conf.cfme_data.basic_info.vddk_url.get(vddk_version) except (KeyError, AttributeError): diff --git a/cfme/fixtures/tag.py b/cfme/fixtures/tag.py index 6ccbf06e0b..3fe446a838 100644 --- a/cfme/fixtures/tag.py +++ b/cfme/fixtures/tag.py @@ -15,20 +15,14 @@ def category(appliance): Returns random created category object Object can be used in all test run session """ - if BZ(1517285, forced_streams='5.9').blocks: - display_name = 'test-{}'.format(fauxfactory.gen_alphanumeric(length=27)) - # display_name should be with max length of 32 - else: - display_name = fauxfactory.gen_alphanumeric(length=32) cg = appliance.collections.categories.create( name=fauxfactory.gen_alpha(8).lower(), description=fauxfactory.gen_alphanumeric(length=32), - display_name=display_name + display_name=fauxfactory.gen_alphanumeric(length=32) ) yield cg - if cg.exists: - cg.delete() + cg.delete_if_exists() @pytest.fixture(scope="session") @@ -42,8 +36,7 @@ def tag(category): display_name=fauxfactory.gen_alphanumeric(length=32) ) yield tag - if tag.exists: - tag.delete() + tag.delete_if_exists() @pytest.fixture(scope="module") @@ -55,7 +48,7 @@ def role(appliance): name='role{}'.format(fauxfactory.gen_alphanumeric()), vm_restriction='None') yield role - role.delete() + role.delete_if_exists() @pytest.fixture(scope="module") @@ -69,7 +62,7 @@ def group_with_tag(appliance, role, category, tag): tag=([category.display_name, tag.display_name], True) ) yield group - group.delete() + group.delete_if_exists() @pytest.fixture(scope="module") @@ -86,7 +79,7 @@ def user_restricted(appliance, group_with_tag, new_credential): cost_center='Workload', value_assign='Database') yield user - user.delete() + user.delete_if_exists() @pytest.fixture(scope="module") diff --git a/cfme/fixtures/ui_coverage.py b/cfme/fixtures/ui_coverage.py index cc1d67a54c..4dddcd3861 100644 --- a/cfme/fixtures/ui_coverage.py +++ b/cfme/fixtures/ui_coverage.py @@ -204,55 +204,11 @@ def _install_coverage_hook(self): # Put the coverage hook in the miq config path self.ipapp.ssh_client.put_file( coverage_hook.strpath, - rails_root.join('config', coverage_hook_file_name).strpath) - # XXX: Once the manageiq PR 17302 makes it into the 5.9 and 5.8 stream we - # can remove all the code in this function after this. This is only - # a temporary fix so we can start acquiring code coverage statistics. - # - # See if we need to install the patch. If not just return. - # The patch will create the file lib/code_coverage.rb under the rails root. - # so if that is there we assume the patch is already installed. - result = self.ipapp.ssh_client.run_command('cd {}; [ -e lib/code_coverage.rb ]'.format( - rails_root)) - if result.success: - return True - # place patch on the system - self.log.info('Patching system with manageiq patch #17302') - coverage_hook_patch_name = 'manageiq-17302.patch' - local_coverage_hook_patch = coverage_data.join(coverage_hook_patch_name) - remote_coverage_hook_patch = rails_root.join(coverage_hook_patch_name) - self.ipapp.ssh_client.put_file( - local_coverage_hook_patch.strpath, - remote_coverage_hook_patch.strpath) - # See if we need to install the patch command: - result = self.ipapp.ssh_client.run_command('rpm -q patch') - if not result.success: - # Setup yum repositories and install patch - local_yum_repo = log_path.join('yum.local.repo') - remote_yum_repo = '/etc/yum.repos.d/local.repo' - repo_data = cfme_data['basic_info']['local_yum_repo'] - yum_repo_data = ''' -[{name}] -name={name} -baseurl={baseurl} -enabled={enabled} -gpgcheck={gpgcheck} -'''.format( - name=repo_data['name'], - baseurl=repo_data['baseurl'], - enabled=repo_data['enabled'], - gpgcheck=repo_data['gpgcheck']) - with open(local_yum_repo.strpath, 'w') as f: - f.write(yum_repo_data) - self.ipapp.ssh_client.put_file(local_yum_repo.strpath, remote_yum_repo) - self.ipapp.ssh_client.run_command('yum install -y patch') - # Remove the yum repo just in case a test of registering the system might - # happen and this repo cause problems with the test. - self.ipapp.ssh_client.run_command('rm {}'.format(remote_yum_repo)) - # patch system. - result = self.ipapp.ssh_client.run_command('cd {}; patch -p1 < {}'.format( - rails_root.strpath, - remote_coverage_hook_patch.strpath)) + rails_root.join('config', coverage_hook_file_name).strpath + ) + result = self.ipapp.ssh_client.run_command( + 'cd {}; [ -e lib/code_coverage.rb ]'.format(rails_root) + ) return result.success def _collect_reports(self): diff --git a/cfme/fixtures/v2v_fixtures.py b/cfme/fixtures/v2v_fixtures.py index 16d55672b4..ef344cd736 100644 --- a/cfme/fixtures/v2v_fixtures.py +++ b/cfme/fixtures/v2v_fixtures.py @@ -141,11 +141,8 @@ def create_tags(appliance, transformation_method): def set_conversion_instance_for_rhev(appliance, transformation_method, rhev_hosts): """Assigning tags to conversion host. - In 5.9 all rhev hosts and tagged with tags V2V - Transformation Host=t - and V2V - Transformation Method=vddk/ssh.These tags are automatically removed - once the provider is deleted. - In 5.10 rails console commands are run to configure all the rhev hosts. + In 5.10 rails console commands are run to configure all the rhev hosts. Args: appliance: @@ -155,27 +152,20 @@ def set_conversion_instance_for_rhev(appliance, transformation_method, rhev_host for host in rhev_hosts: # set conversion host via rails console - if appliance.version >= "5.10": - # Delete all prior conversion hosts otherwise it creates duplicate entries - delete_hosts = appliance.ssh_client.run_rails_command("'ConversionHost.delete_all'") - if not delete_hosts.success: - pytest.skip("Failed to delete all conversion hosts:".format(delete_hosts.output)) - - set_conv_host = appliance.ssh_client.run_rails_command( - "'r = Host.find_by(name:{host});\ - c_host = ConversionHost.create(name:{host},resource:r);\ - c_host.{method}_transport_supported = true;\ - c_host.save'".format(host=json.dumps(host.name), - method=transformation_method.lower()) - ) - if not set_conv_host.success: - pytest.skip("Failed to set conversion hosts:".format(set_conv_host.output)) - else: - tag1, tag2 = create_tags(appliance, transformation_method) - # if _tag_cleanup() returns True, means all tags were removed - if _tag_cleanup(host, tag1, tag2): - # so we call add_tags to add only required tags - host.add_tags(tags=(tag1, tag2)) + # Delete all prior conversion hosts otherwise it creates duplicate entries + delete_hosts = appliance.ssh_client.run_rails_command("'ConversionHost.delete_all'") + if not delete_hosts.success: + pytest.skip("Failed to delete all conversion hosts:".format(delete_hosts.output)) + + set_conv_host = appliance.ssh_client.run_rails_command( + "'r = Host.find_by(name:{host});\ + c_host = ConversionHost.create(name:{host},resource:r);\ + c_host.{method}_transport_supported = true;\ + c_host.save'".format(host=json.dumps(host.name), + method=transformation_method.lower()) + ) + if not set_conv_host.success: + pytest.skip("Failed to set conversion hosts:".format(set_conv_host.output)) def set_conversion_instance_for_osp(appliance, osp_provider, transformation_method='vddk'): diff --git a/cfme/infrastructure/cluster.py b/cfme/infrastructure/cluster.py index 741a23789a..45ed9e34d2 100644 --- a/cfme/infrastructure/cluster.py +++ b/cfme/infrastructure/cluster.py @@ -194,23 +194,21 @@ def delete(self, cancel=True, wait=False): wait: Whether or not to wait for the delete to complete, defaults to False """ view = navigate_to(self, 'Details') - msg = 'Remove item' - if self.appliance.version >= '5.9': - msg = 'Remove item from Inventory' - view.toolbar.configuration.item_select(msg, handle_alert=not cancel) + view.toolbar.configuration.item_select('Remove item from Inventory', + handle_alert=not cancel) # cancel doesn't redirect, confirmation does view.flush_widget_cache() if cancel: - view = self.create_view(ClusterDetailsView) + view = self.create_view(ClusterDetailsView, wait=10) else: - view = self.create_view(ClusterAllView) - wait_for(lambda: view.is_displayed, fail_condition=False, num_sec=10, delay=1) + view = self.create_view(ClusterAllView, wait=10) # flash message only displayed if it was deleted if not cancel: - msg = 'The selected Clusters / Deployment Roles was deleted' - view.flash.assert_success_message(msg) + view.flash.assert_success_message( + 'The selected Clusters / Deployment Roles was deleted' + ) if wait: self.provider.refresh_provider_relationships() @@ -222,7 +220,7 @@ def wait_for_disappear(self, timeout=300): return wait_for(lambda: not self.exists, timeout=timeout, message='Wait for cluster to disappear', - delay=10, + delay=5, fail_func=self.browser.refresh) except TimedOutError: logger.error('Timed out waiting for cluster to disappear, continuing') @@ -234,8 +232,7 @@ def wait_for_exists(self): def refresh(): if self.provider: self.provider.refresh_provider_relationships() - view.browser.selenium.refresh() - view.flush_widget_cache() + view.browser.refresh() wait_for(lambda: self.exists, fail_condition=False, num_sec=1000, fail_func=refresh, message='Wait cluster to appear') @@ -328,14 +325,11 @@ def delete(self, *clusters): raise ValueError( 'Some Clusters {!r} were not found in the UI'.format( cluster_names - checked_cluster_names)) - if self.appliance.version < '5.9': - view.toolbar.configuration.item_select('Remove selected items', handle_alert=True) - else: - view.toolbar.configuration.item_select( - 'Remove selected items from Inventory', handle_alert=True) + view.toolbar.configuration.item_select('Remove selected items from Inventory', + handle_alert=True) view.flash.assert_no_error() - flash_msg = ('Delete initiated for {} Clusters / Deployment Roles from the CFME Database'. - format(len(clusters))) + flash_msg = ('Delete initiated for {} Clusters / Deployment Roles from the CFME Database' + .format(len(clusters))) view.flash.assert_message(flash_msg) for cluster in clusters: cluster.wait_for_disappear() diff --git a/cfme/infrastructure/datastore.py b/cfme/infrastructure/datastore.py index 7bed4e9985..ad8046d92b 100644 --- a/cfme/infrastructure/datastore.py +++ b/cfme/infrastructure/datastore.py @@ -199,9 +199,7 @@ def delete(self, cancel=True): """ # BZ 1467989 - this button is never getting enabled for some resources view = navigate_to(self, 'Details') - view.toolbar.configuration.item_select('Remove Datastore from Inventory' - if self.appliance.version >= '5.9' - else 'Remove Datastore', + view.toolbar.configuration.item_select('Remove Datastore from Inventory', handle_alert=(not cancel)) view.flash.assert_success_message('Delete initiated for Datastore from the CFME Database') @@ -240,9 +238,7 @@ def delete_all_attached_vms(self): vms_view = view.browser.create_view(DatastoresView) for entity in vms_view.entities.get_all(): entity.check() - view.toolbar.configuration.item_select('Remove selected items from Inventory' - if self.appliance.version >= '5.9' - else 'Remove selected items', + view.toolbar.configuration.item_select('Remove selected items from Inventory', handle_alert=True) wait_for(lambda: bool(len(vms_view.entities.get_all())), fail_condition=True, @@ -255,9 +251,7 @@ def delete_all_attached_hosts(self): hosts_view = view.browser.create_view(RegisteredHostsView) for entity in hosts_view.entities.get_all(): entity.check() - view.toolbar.configuration.item_select('Remove items from Inventory' - if self.appliance.version >= '5.9' - else 'Remove items', + view.toolbar.configuration.item_select('Remove items from Inventory', handle_alert=True) wait_for(lambda: bool(len(hosts_view.entities.get_all())), fail_condition=True, @@ -267,8 +261,8 @@ def delete_all_attached_hosts(self): @property def exists(self): try: - view = navigate_to(self, 'Details') - return view.is_displayed + navigate_to(self, 'Details') + return True except ItemNotFound: return False diff --git a/cfme/infrastructure/deployment_roles.py b/cfme/infrastructure/deployment_roles.py index 7d3249aafa..df99d5ec26 100644 --- a/cfme/infrastructure/deployment_roles.py +++ b/cfme/infrastructure/deployment_roles.py @@ -191,18 +191,14 @@ def provider(self): def delete(self, cancel=False): view = navigate_to(self, 'Details') - if self.appliance.version < '5.9': - remove_item = 'Remove item' - else: - remove_item = 'Remove item from Inventory' - view.toolbar.configuration.item_select(remove_item, + view.toolbar.configuration.item_select('Remove item from Inventory', handle_alert=not cancel) if not cancel: - view = self.create_view(DeploymentRoleAllView) - assert view.is_displayed - view.flash.assert_success_message("The selected Clusters / " - "Deployment Roles was deleted") + view = self.create_view(DeploymentRoleAllView, wait=5) + view.flash.assert_success_message( + "The selected Clusters / Deployment Roles was deleted" + ) @attr.s diff --git a/cfme/infrastructure/pxe.py b/cfme/infrastructure/pxe.py index c9808083bf..9582a5117e 100644 --- a/cfme/infrastructure/pxe.py +++ b/cfme/infrastructure/pxe.py @@ -998,14 +998,12 @@ def delete(self, cancel=True): """ view = navigate_to(self, 'Details') - msg = 'Remove this ISO Datastore' - if self.appliance.version >= '5.9': - msg = 'Remove this ISO Datastore from Inventory' - view.toolbar.configuration.item_select(msg, handle_alert=not cancel) + view.toolbar.configuration.item_select('Remove this ISO Datastore from Inventory', + handle_alert=not cancel) if not cancel: main_view = self.create_view(PXEDatastoresView) - msg = 'ISO Datastore "{}": Delete successful'.format(self.provider) - main_view.flash.assert_success_message(msg) + main_view.flash.assert_success_message('ISO Datastore "{}": Delete successful' + .format(self.provider)) else: navigate_to(self, 'Details') diff --git a/cfme/infrastructure/resource_pool.py b/cfme/infrastructure/resource_pool.py index b7138afb80..bd2e81245c 100644 --- a/cfme/infrastructure/resource_pool.py +++ b/cfme/infrastructure/resource_pool.py @@ -138,31 +138,23 @@ def delete(self, cancel=False, wait=False): wait: Whether or not to wait for the delete, defaults to False """ view = navigate_to(self, 'Details') - if self.appliance.version < '5.9': - item_name = 'Remove Resource Pool' - else: - item_name = 'Remove Resource Pool from Inventory' - view.toolbar.configuration.item_select(item_name, handle_alert=not cancel) + view.toolbar.configuration.item_select('Remove Resource Pool from Inventory', + handle_alert=not cancel) - # cancel doesn't redirect, confirmation does - view.flush_widget_cache() if cancel: - view = self.create_view(ResourcePoolDetailsView) + view = self.create_view(ResourcePoolDetailsView, wait=10) else: - view = self.create_view(ResourcePoolAllView) - wait_for(lambda: view.is_displayed, fail_condition=False, num_sec=10, delay=1) + view = self.create_view(ResourcePoolAllView, wait=10) # flash message only displayed if it was deleted if not cancel: - msg = 'The selected Resource Pools was deleted' - view.flash.assert_success_message(msg) + view.flash.assert_success_message('The selected Resource Pools was deleted') if wait: def refresh(): if self.provider: self.provider.refresh_provider_relationships() view.browser.refresh() - view.flush_widget_cache() wait_for(lambda: not self.exists, fail_condition=False, fail_func=refresh, num_sec=500, message='Wait for resource pool to be deleted') @@ -175,7 +167,6 @@ def refresh(): if self.provider: self.provider.refresh_provider_relationships() view.browser.refresh() - view.flush_widget_cache() wait_for(lambda: self.exists, fail_condition=False, num_sec=1000, fail_func=refresh, message='Wait resource pool to appear') diff --git a/cfme/infrastructure/virtual_machines.py b/cfme/infrastructure/virtual_machines.py index 1f83ba98b9..d6e3e1515d 100644 --- a/cfme/infrastructure/virtual_machines.py +++ b/cfme/infrastructure/virtual_machines.py @@ -55,9 +55,6 @@ from cfme.utils.log import logger from cfme.utils.pretty import Pretty from cfme.utils.providers import get_crud_by_name -from cfme.utils.version import UPSTREAM -from cfme.utils.version import Version -from cfme.utils.version import VersionPicker from cfme.utils.wait import wait_for from widgetastic_manageiq import Accordion from widgetastic_manageiq import CompareToolBarActionsView @@ -399,9 +396,7 @@ class InfraVmSnapshotAddView(InfraVmView): title = Text('#explorer_title_text') name = TextInput('name') description = TextInput('description') - snapshot_vm_memory = VersionPicker({ - Version.lowest(): Checkbox('snap_memory'), - '5.10': SnapshotMemorySwitch()}) + snapshot_vm_memory = SnapshotMemorySwitch() create = Button('Create') cancel = Button('Cancel') @@ -689,12 +684,10 @@ def delete(self, cancel=False): view.toolbar.delete.item_select('Delete Selected Snapshot', handle_alert=not cancel) if not cancel: - flash_message = VersionPicker({ - UPSTREAM: "Delete Snapshot initiated for 1 " - "VM and Instance from the ManageIQ Database", - '5.9': "Delete Snapshot initiated for 1 VM and Instance from the CFME Database" - }).pick(self.parent_vm.appliance.version) - view.flash.assert_message(flash_message) + # TODO: test this in test_snapshot_crud, just assert_no_error here + view.flash.assert_message( + "Delete Snapshot initiated for 1 VM and Instance from the ManageIQ Database" + ) wait_for(lambda: not self.exists, num_sec=300, delay=20, fail_func=view.browser.refresh, message="Waiting for snapshot delete") @@ -704,14 +697,11 @@ def delete_all(self, cancel=False): view.toolbar.delete.item_select('Delete All Existing Snapshots', handle_alert=not cancel) if not cancel: - flash_message = VersionPicker({ - UPSTREAM: "Delete All Snapshots initiated for 1 VM " - "and Instance from the ManageIQ Database", - '5.9': "Delete All Snapshots initiated for 1 VM " - "and Instance from the CFME Database" - }).pick(self.parent_vm.appliance.version) - - view.flash.assert_message(flash_message) + # TODO: test this in test_snapshot_crud, just assert_no_error here + view.flash.assert_message( + "Delete All Snapshots initiated for 1 VM and Instance from the " + "ManageIQ Database" + ) def revert_to(self, cancel=False): title = getattr(self, self.parent_vm.provider.SNAPSHOT_TITLE) @@ -725,13 +715,11 @@ def revert_to(self, cancel=False): view.toolbar.revert.click(handle_alert=not cancel) if not cancel: - flash_message = VersionPicker({ - UPSTREAM: "Revert to a Snapshot initiated for 1 VM and Instance " - "from the ManageIQ Database", - '5.9': "Revert to a Snapshot initiated for 1 VM and Instance from " - "the CFME Database" - }).pick(self.parent_vm.appliance.version) - view.flash.assert_message(flash_message) + # TODO: test this in test_snapshot_crud, just assert_no_error here + view.flash.assert_message( + "Revert to a Snapshot initiated for 1 VM and Instance " + "from the ManageIQ Database" + ) def refresh(self): view = navigate_to(self.parent_vm, 'SnapshotsAll') @@ -1087,10 +1075,7 @@ def vm_default_args_rest(self): inst_args['vm_fields']['provision_type'] = 'native_clone' cluster_id = self.appliance.rest_api.collections.clusters.get(name='Default').id inst_args['vm_fields']['placement_cluster_name'] = cluster_id - # TODO Workaround for BZ 1541036/1449157.