Skip to content

Commit

Permalink
Merge branch 'master' into all-hosts-manage-columns
Browse files Browse the repository at this point in the history
  • Loading branch information
sambible authored Jun 18, 2024
2 parents b3eeaf2 + 2577467 commit ec5d8d7
Show file tree
Hide file tree
Showing 37 changed files with 398 additions and 210 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:
PYCURL_SSL_LIBRARY: openssl
ROBOTTELO_BUGZILLA__API_KEY: ${{ secrets.BUGZILLA_KEY }}
ROBOTTELO_JIRA__API_KEY: ${{ secrets.JIRA_KEY }}
ROBOTTELO_ROBOTTELO__SETTINGS__IGNORE_VALIDATION_ERRORS: true

jobs:
codechecks:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
- id: check-yaml
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.8
rev: v0.4.9
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -28,6 +28,6 @@ repos:
types: [text]
require_serial: true
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.3
rev: v8.18.4
hooks:
- id: gitleaks
1 change: 1 addition & 0 deletions conf/capsule.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ CAPSULE:
OS: deploy-rhel # workflow to deploy OS that is ready to run the product
# Dictionary of arguments which should be passed along to the deploy workflow
DEPLOY_ARGUMENTS:
# deploy_network_type: '@jinja {{"ipv6" if this.server.is_ipv6 else "ipv4"}}'
6 changes: 0 additions & 6 deletions conf/certs.yaml.template

This file was deleted.

5 changes: 0 additions & 5 deletions conf/clients.yaml.template

This file was deleted.

3 changes: 0 additions & 3 deletions conf/discovery.yaml.template

This file was deleted.

6 changes: 0 additions & 6 deletions conf/distro.yaml.template

This file was deleted.

3 changes: 2 additions & 1 deletion conf/dynaconf_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from robottelo.logging import logger
from robottelo.utils.ohsnap import dogfood_repository
from robottelo.utils.url import is_url
from robottelo.utils.url import ipv6_hostname_translation, is_url


def post(settings):
Expand All @@ -26,6 +26,7 @@ def post(settings):
)
data = get_repos_config(settings)
write_cache(settings_cache_path, data)
ipv6_hostname_translation(settings, data)
config_migrations(settings, data)
data['dynaconf_merge'] = True
return data
Expand Down
1 change: 1 addition & 0 deletions conf/robottelo.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ ROBOTTELO:
# Dynaconf and Dynaconf hooks related options
SETTINGS:
GET_FRESH: true
IGNORE_VALIDATION_ERRORS: false
5 changes: 5 additions & 0 deletions conf/server.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ SERVER:
SOURCE: "internal"
# The RHEL Base OS Version(x.y) where the Satellite is installed
RHEL_VERSION: '7'
# If the the satellite server is IPv6 server
IS_IPV6: False
# HTTP Proxy url for IPv6 satellite to connect for outer world access
HTTP_PROXY_IPv6_URL:
# run-on-one - All xdist runners default to the first satellite
# balance - xdist runners will be split between available satellites
# on-demand - any xdist runner without a satellite will have a new one provisioned.
Expand All @@ -32,6 +36,7 @@ SERVER:
OS: deploy-rhel # workflow to deploy OS that is ready to run the product
# Dictionary of arguments which should be passed along to the deploy workflow
# DEPLOY_ARGUMENTS:
# deploy_network_type: '@jinja {{"ipv6" if this.server.is_ipv6 else "ipv4"}}'
# HTTP scheme when building the server URL
# Suggested values for "scheme" are "http" and "https".
SCHEME: https
Expand Down
4 changes: 3 additions & 1 deletion pytest_fixtures/component/maintain.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def module_stash(request):
@pytest.fixture(scope='module')
def sat_maintain(request, module_target_sat, module_capsule_configured):
if settings.remotedb.server:
yield Satellite(settings.remotedb.server)
sat = Satellite(settings.remotedb.server)
sat.enable_ipv6_http_proxy()
yield sat
else:
module_target_sat.register_to_cdn(pool_ids=settings.subscription.fm_rhn_poolid.split())
hosts = {'satellite': module_target_sat, 'capsule': module_capsule_configured}
Expand Down
3 changes: 3 additions & 0 deletions pytest_fixtures/core/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def _target_sat_imp(request, _default_sat, satellite_factory):
"""This is the actual working part of the following target_sat fixtures"""
if request.node.get_closest_marker(name='destructive'):
new_sat = satellite_factory()
new_sat.enable_ipv6_http_proxy()
yield new_sat
new_sat.teardown()
Broker(hosts=[new_sat]).checkin()
Expand All @@ -32,6 +33,8 @@ def _target_sat_imp(request, _default_sat, satellite_factory):
settings.set('server.hostname', installer_sat.hostname)
yield installer_sat
else:
if _default_sat:
_default_sat.enable_ipv6_http_proxy()
yield _default_sat


Expand Down
18 changes: 13 additions & 5 deletions pytest_fixtures/core/sat_cap_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def resolve_deploy_args(args_dict):
def _target_satellite_host(request, satellite_factory):
if 'sanity' not in request.config.option.markexpr:
new_sat = satellite_factory()
new_sat.enable_ipv6_http_proxy()
yield new_sat
new_sat.teardown()
Broker(hosts=[new_sat]).checkin()
Expand All @@ -48,6 +49,7 @@ def cached_capsule_cdn_register(hostname=None):
def _target_capsule_host(request, capsule_factory):
if 'sanity' not in request.config.option.markexpr and not request.config.option.n_minus:
new_cap = capsule_factory()
new_cap.enable_ipv6_http_proxy()
yield new_cap
new_cap.teardown()
Broker(hosts=[new_cap]).checkin()
Expand Down Expand Up @@ -94,6 +96,7 @@ def factory(retry_limit=3, delay=300, workflow=None, **broker_args):
def large_capsule_host(capsule_factory):
"""A fixture that provides a Capsule based on config settings"""
new_cap = capsule_factory(deploy_flavor=settings.flavors.custom_db)
new_cap.enable_ipv6_http_proxy()
yield new_cap
new_cap.teardown()
Broker(hosts=[new_cap]).checkin()
Expand Down Expand Up @@ -244,6 +247,7 @@ def module_lb_capsule(retry_limit=3, delay=300, **broker_args):
)
cap_hosts = wait_for(hosts.checkout, timeout=timeout, delay=delay)

[cap.enable_ipv6_http_proxy() for cap in cap_hosts.out]
yield cap_hosts.out

[cap.teardown() for cap in cap_hosts.out]
Expand Down Expand Up @@ -278,6 +282,7 @@ def parametrized_enrolled_sat(
):
"""Yields a Satellite enrolled into [IDM, AD] as parameter."""
new_sat = satellite_factory()
new_sat.enable_ipv6_http_proxy()
ipa_host = IPAHost(new_sat)
new_sat.register_to_cdn()
if 'IDM' in request.param:
Expand All @@ -297,6 +302,7 @@ def get_deploy_args(request):
rhel_version = get_sat_rhel_version()
deploy_args = {
'deploy_rhel_version': rhel_version.base_version,
'deploy_network_type': 'ipv6' if settings.server.is_ipv6 else 'ipv4',
'deploy_flavor': settings.flavors.default,
'promtail_config_template_file': 'config_sat.j2',
'workflow': settings.server.deploy_workflows.os,
Expand Down Expand Up @@ -328,11 +334,13 @@ def cap_ready_rhel():
rhel_version = Version(settings.capsule.version.rhel_version)
deploy_args = {
'deploy_rhel_version': rhel_version.base_version,
'deploy_network_type': 'ipv6' if settings.server.is_ipv6 else 'ipv4',
'deploy_flavor': settings.flavors.default,
'promtail_config_template_file': 'config_sat.j2',
'workflow': settings.capsule.deploy_workflows.os,
}
with Broker(**deploy_args, host_class=Capsule) as host:
host.enable_ipv6_http_proxy()
yield host


Expand All @@ -352,7 +360,7 @@ def installer_satellite(request):
sat = lru_sat_ready_rhel(getattr(request, 'param', None))
sat.setup_firewall()
# # Register for RHEL8 repos, get Ohsnap repofile, and enable and download satellite
sat.register_to_cdn()
sat.register_to_cdn(enable_proxy=True)
sat.download_repofile(
product='satellite',
release=settings.server.version.release,
Expand All @@ -371,12 +379,12 @@ def installer_satellite(request):
).get_command(),
timeout='30m',
)
sat.enable_ipv6_http_proxy()
if 'sanity' in request.config.option.markexpr:
configure_nailgun()
configure_airgun()
yield sat
if 'sanity' not in request.config.option.markexpr:
sanity_sat = Satellite(sat.hostname)
sanity_sat.unregister()
broker_sat = Satellite.get_host_by_hostname(sanity_sat.hostname)
Broker(hosts=[broker_sat]).checkin()
sat = Satellite.get_host_by_hostname(sat.hostname)
sat.unregister()
Broker(hosts=[sat]).checkin()
5 changes: 3 additions & 2 deletions pytest_fixtures/core/xdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ def align_to_satellite(request, worker_id, satellite_factory):
if settings.server.hostname:
sanity_sat = Satellite(settings.server.hostname)
sanity_sat.unregister()
broker_sat = Satellite.get_host_by_hostname(sanity_sat.hostname)
Broker(hosts=[broker_sat]).checkin()
if settings.server.auto_checkin:
broker_sat = Satellite.get_host_by_hostname(sanity_sat.hostname)
Broker(hosts=[broker_sat]).checkin()
else:
# clear any hostname that may have been previously set
settings.set("server.hostname", None)
Expand Down
4 changes: 2 additions & 2 deletions requirements-optional.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# For running tests and checking code quality using these modules.
flake8==7.0.0
flake8==7.1.0
pytest-cov==5.0.0
redis==5.0.5
redis==5.0.6
pre-commit==3.7.1

# For generating documentation.
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ manifester==0.2.4
navmazing==1.2.2
productmd==1.38
pyotp==2.9.0
python-box==7.1.1
python-box==7.2.0
pytest==8.2.2
pytest-order==1.2.1
pytest-services==2.2.1
Expand All @@ -23,7 +23,7 @@ pytest-fixturecollection==0.1.2
pytest-ibutsu==2.2.4
PyYAML==6.0.1
requests==2.32.3
tenacity==8.3.0
tenacity==8.4.1
testimony==2.4.0
wait-for==1.2.0
wrapanapi==3.6.0
Expand Down
8 changes: 4 additions & 4 deletions robottelo/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def get_settings():
try:
settings.validators.validate()
except ValidationError as err:
logger.warning(
f'Dynaconf validation failed, continuing for the sake of unit tests\n{err}'
)

if settings.robottelo.settings.get('ignore_validation_errors'):
logger.warning(f'Dynaconf validation failed with\n{err}')
else:
raise err
return settings


Expand Down
31 changes: 10 additions & 21 deletions robottelo/config/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
Validator('server.ssh_username', default='root'),
Validator('server.ssh_password', default=None),
Validator('server.verify_ca', default=False),
Validator('server.is_ipv6', is_type_of=bool, default=False),
# validate http_proxy_ipv6_url only if is_ipv6 is True
Validator(
'server.http_proxy_ipv6_url',
is_type_of=str,
when=Validator('server.is_ipv6', eq=True),
),
],
content_host=[
Validator('content_host.default_rhel_version', must_exist=True),
Expand Down Expand Up @@ -78,16 +85,6 @@
Validator('capsule.deploy_workflows.os', must_exist=True),
Validator('capsule.deploy_arguments', must_exist=True, is_type_of=dict, default={}),
],
certs=[
Validator(
'certs.cert_file',
'certs.key_file',
'certs.req_file',
'certs.ca_bundle_file',
must_exist=True,
)
],
clients=[Validator('clients.provisioning_server')],
libvirt=[
Validator('libvirt.libvirt_hostname', must_exist=True),
Validator('libvirt.libvirt_image_dir', default='/var/lib/libvirt/images'),
Expand All @@ -109,17 +106,6 @@
must_exist=True,
),
],
discovery=[Validator('discovery.discovery_iso', must_exist=True)],
distro=[
Validator(
'distro.image_el7',
'distro.image_el6',
'distro.image_el8',
'distro.image_sles11',
'distro.image_sles12',
must_exist=True,
)
],
docker=[
Validator(
'docker.external_registry_1',
Expand Down Expand Up @@ -328,6 +314,9 @@
Validator('remotedb.ssl', default=True),
Validator('remotedb.port', default=5432),
],
robottelo=[
Validator('robottelo.settings.ignore_validation_errors', is_type_of=bool, default=False),
],
shared_function=[
Validator('shared_function.storage', is_in=('file', 'redis'), default='file'),
Validator('shared_function.share_timeout', lte=86400, default=86400),
Expand Down
11 changes: 8 additions & 3 deletions robottelo/host_helpers/contenthost_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ def _dogfood_helper(self, product, release, repo=None):
)
return product, release, v_major, repo

def download_repofile(self, product=None, release=None, snap=''):
def download_repofile(self, product=None, release=None, snap='', proxy=None):
"""Downloads the tools/client, capsule, or satellite repos on the machine"""
product, release, v_major, _ = self._dogfood_helper(product, release)
url = dogfood_repofile_url(settings.ohsnap, product, release, v_major, snap)
self.execute(f'curl -o /etc/yum.repos.d/dogfood.repo -L {url}')
if not proxy and settings.server.is_ipv6:
proxy = settings.server.http_proxy_ipv6_url
url = dogfood_repofile_url(settings.ohsnap, product, release, v_major, snap, proxy=proxy)
command = f'curl -o /etc/yum.repos.d/dogfood.repo -L {url}'
if settings.server.is_ipv6:
command += f' -x {settings.server.http_proxy_ipv6_url}'
self.execute(command)

def dogfood_repository(self, repo=None, product=None, release=None, snap=''):
"""Returns a repository definition based on the arguments provided"""
Expand Down
Loading

0 comments on commit ec5d8d7

Please sign in to comment.