robottelo icon indicating copy to clipboard operation
robottelo copied to clipboard

helper refactor to get repo names based on os version

Open tstrych opened this issue 3 years ago • 1 comments

@tstrych instead of doing repo setup in a fixture, reading names to determine version, this could be done with helper functions. This is something I've been talking about for some time now and will be part of the helpers refactor. We can talk about more tomorrow.

Originally posted by @JacobCallahan in https://github.com/SatelliteQE/robottelo/issues/9113#issuecomment-960085270

tstrych avatar Nov 30 '21 12:11 tstrych

mentioned repo_setup

@pytest.fixture(scope="function")
def repo_setup(rhel_version):
    repository_set = repository = product = None
    if rhel_version == 'rhel6':
        product = PRDS['rhel6']
        repository_set = REPOSET['rhst6']
        repository = REPOS['rhst6']['name']
    elif rhel_version == 'rhel7':
        product = PRDS['rhel']
        repository_set = REPOSET['rhst7']
        repository = REPOS['rhst7']['name']
    elif rhel_version == 'rhel8':
        product = PRDS['rhel8']
        repository_set = REPOSET['rhst8']
        repository = REPOS['rhst8']['name']
    if not (repository and repository_set and product):
        raise ValueError('Please specify the repository, repository-set and product')
    return {
        'product': product,
        'repository_set': repository_set,
        'repository': repository,
    }

so host_product should be by default based on the rhel version rhel8_content_host.product -> mapped to constant PRDS['rhel8'] it's more tricky when it comes to all repository sets and repos I would imagine reposets and repos rhel8_content_host.reposets -> dictionary with all reposets where name is repo name for example rhst8 rhst and value REPOSET['rhst8']

similar to repos, but the value will be dict with all repo params id, name and so on...

tstrych avatar Nov 30 '21 12:11 tstrych