Skip to content

Commit

Permalink
Enforce the Dynaconf validaton
Browse files Browse the repository at this point in the history
  • Loading branch information
ogajduse committed Jun 17, 2024
1 parent 90ffb9b commit 4eeef2e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 45 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__SKIP_VALIDATION: true

jobs:
codechecks:
Expand Down
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.

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
SKIP_VALIDATION: false
10 changes: 6 additions & 4 deletions robottelo/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ 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('skip_validation'):
logger.warning(
f'Dynaconf validation failed, continuing for the sake of unit tests\n{err}'
)
else:
raise err
return settings


Expand Down
24 changes: 3 additions & 21 deletions robottelo/config/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,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 @@ -116,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 @@ -335,6 +314,9 @@
Validator('remotedb.ssl', default=True),
Validator('remotedb.port', default=5432),
],
robottelo=[
Validator('robottelo.settings.skip_validation', 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

0 comments on commit 4eeef2e

Please sign in to comment.