Bug 1971607

Summary: [RFE] Implement a Validation config file
Product: Red Hat OpenStack Reporter: mathieu bultel <mbultel>
Component: python-validations-libsAssignee: mathieu bultel <mbultel>
Status: CLOSED ERRATA QA Contact: David Rosenfeld <drosenfe>
Severity: medium Docs Contact:
Priority: high    
Version: 17.0 (Wallaby)CC: gchamoul, gregraka, jamsmith, joflynn, jpodivin, mariel, nlevinki, pweeks, scohen, spower
Target Milestone: AlphaKeywords: FutureFeature, Triaged
Target Release: 17.0Flags: scohen: needinfo+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: Triaged
Fixed In Version: python-validations-libs-1.3.1-0.20210827002945.11488cd.el8ost Doc Type: Enhancement
Doc Text:
With this update, the Validation Framework provides a configuration file in which you can set parameters for particular use. You can find an example of this file at the root of the code source or in the default location: `/etc/validation.cfg`. + You can use the default file in `/etc/` or use your own file and provide it to the CLI with the argument `--config`. + When you use a configuration file there is an order for the variables precedence. The following order is the order of variable precedence: + * User's CLI arguments * Configuration file * Default interval values
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-21 12:15:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1985345    

Description mathieu bultel 2021-06-14 12:35:07 UTC
Description of problem:

Since the VF has a proper CLI included in validations-libs, it make sense to implement a validation.cfg config file in order to provide severals parameters through it.


For a 1st iteration the goals will be:

* the used of ConfigParser python builtin to avoid too much dependencies and links with other Openstack  projects.

* a minimal set of sections: default / ansible_runner / ansible_environment

The default will be the settings for the CLI parameters.
Ansible Runner, a way to override the ansible runner options
Ansible Environment will expose all the Ansible env variables available in Ansible so the user can edit, update, configure them without export each time those values.

* The precedence of the parameters will be as Ansible CLI does:
    * User CLI parameters take precedence on all the other values
    * The config is loaded on each run if found, and will override the default parameters
example:
config file:
[default]
validation_dir = /home/foo


$ validation run --validation foo --validation-dir /foo/bar
-> validation_dir is /foo/bar

$ validation run --validation foo
-> validation_dir is /home/foo

Config file not found:
$ validation run --validation foo
-> validation_dir is /usr/share/ansible/validation-playbooks

Comment 6 mathieu bultel 2022-08-26 07:34:06 UTC
Thank you Andy, I have added few informations for this BZ for the documentation.

Comment 10 errata-xmlrpc 2022-09-21 12:15:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Release of components for Red Hat OpenStack Platform 17.0 (Wallaby)), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2022:6543