Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #10164 from tpapaioa/fix_managed_known_providers
Browse files Browse the repository at this point in the history
[1LP][RFR] Fix to managed_known_providers name checking
  • Loading branch information
mshriver authored Jun 5, 2020
2 parents edf2bf6 + ff5c35b commit b535731
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cfme/utils/appliance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
# A helper for the IDs
SEQ_FACT = 1e12

EMBEDDED_PROVIDERS = ('Embedded Ansible', )


def _current_miqqe_version():
"""Parses MiqQE JS patch version from the patch file
Expand Down Expand Up @@ -602,12 +604,13 @@ def managed_known_providers(self):
found_cruds = set()
unrecognized_ems_names = set()
for ems_name in self.managed_provider_names:
if ems_name in EMBEDDED_PROVIDERS:
# ignore embedded pre-configured providers
continue
for prov in prov_cruds:
# Name check is authoritative and the only proper way to recognize a known provider
if ems_name == prov.name:
found_cruds.add(prov)
break
elif prov.name in ems_name: # config managers append e.g. 'Automation Manager'
# Match either by exact name or by child provider name, e.g., 'XXX Network Manager'
if ems_name == prov.name or re.match(f'^{prov.name} [A-Za-z]+ Manager$', ems_name):
found_cruds.add(prov)
break
else:
Expand Down
19 changes: 19 additions & 0 deletions cfme/utils/tests/test_providers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest

from cfme.cloud.provider.azure import AzureProvider
from cfme.common.provider import BaseProvider
from cfme.markers.env_markers.provider import ONE_PER_VERSION


@pytest.mark.provider([AzureProvider], selector=ONE_PER_VERSION)
def test_provider_fixtures(provider, setup_provider):
"""Verify that clearing providers works correctly.
Polarion:
assignee: tpapaioa
casecomponent: Appliance
initialEstimate: 1/15h
"""
assert provider.exists, f"Provider {provider.name} not found on appliance."
BaseProvider.clear_providers()
assert not provider.exists, f"Provider {provider.name} not deleted from appliance."

0 comments on commit b535731

Please sign in to comment.