Fstrings are a python 3.6 feature, in order to faciliate porting
to early architectures the fstrings were converted to .format
Change-Id: Ib23097c149ec8ff06cc70bb873b53ee45645ff15
As a result of a minor oversight, the test execution could
initiate a successful call to the 'open' and write in the storage.
This patch addresses the issue.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Iceb6df712b2ac0dc56aa86f465fd39cf308de2d7
When using the custom callback feature through the run CLI subcommand,
by passing --extra-env-vars ANSIBLE_STDOUT_CALLBACK=default, the spinner
makes the output a bit ugly.
This patch disables the spinner in non quiet mode.
Change-Id: I9f92894fe446f4881e0234b1577e49f9e7091b7b
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
The validation framework now respect and look for community
validation on the path. There config setting for
enable_community_validations is respected.
The community validations appear on validations list,
can be called by group, category, id and so on seamless
like any other validation.
Change-Id: I4a6230ac5433028c7297fa88f77728c87d60173d
Signed-off-by: Adriano Petrich (apetrich) <apetrich@redhat.com>
Openstack Client and Validation Shell is hitting a regression
due to set_argument_parser calling directly parse_known_args
from argparse.
This patch fix the regression and avoid the need to call
parse_known_args directly.
Closes-Bug: #1949596
Change-Id: Ic9a682e7c3d5431e8779064947bd379c00aba584
This patch enforces the roles and playbooks checks when creating a new
community validation by checking first if the ANSIBLE_ROLES_DIR and
ANSIBLE_VALIDATION_DIR are existing in the host.
It avoids getting error message like:
- [Errno 2] No such file or directory: '/usr/share/ansible/roles'
when validations-common and tripleo-validations are not installed.
It also adjusts the unittests in order to avoid leaving leftovers such
as community-validations directory during the test execution.
Change-Id: I6facca59c2ca9db2b5b1e7905ad8c9be68fff0b4
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
Presently, the operator(s) can only execute the official and supported
validations coming from tripleo-validations and validations-common.
Community validations enable a sysadmin to create and execute
validations unique to their environment.
This patch introduces the new Command Line Interface sub command to
create a new community validation skeleton. First, this latter will
check if there is an existing role or a playbook either in the community
validations catalog or the official validations catalog. And it will
create an Ansible role (with ansible-galaxy[1]) and a playbook in the
~/community-validations directory.
By default, the community validations feature is enabled but may be
disabled by setting [DEFAULT].enable_community_validations to ``False``
in the validation configuration file.
Example:
[stack@localhost]$ validation init my-new-validation
Validation config file found: /etc/validation.cfg
New role created successfully in /home/stack/community-validations/roles/my_new_validation
New playbook created successfully in /home/stack/community-validations/playbooks/my-new-validation.yaml
For a full demo of this new CLI sub command, please take a look at this
asciinema[2].
[1] - https://docs.ansible.com/ansible/latest/cli/ansible-galaxy.html
[2] - https://asciinema.org/a/445105
Change-Id: I8fb16e3456696187d4a9d3820740a7639a96e315
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
The default value of the validation_path parameter
is now handled properly, without unnecessary conditional.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I4cc16732ea9d98ec47c2dc616105944bdd6106f0
The skip list feature was available only via the API, this patch
allow the user to pass a file with the list of the validations
which he wants to skip during the run, example:
check-ram: hosts: all
reason: Wrong ram value
lp: https://lp.fake.net
check-cpu: hosts: undercloud
reason: Unstable validation
lp: https://lp.fake.net
Change-Id: I04059f9339085e0dcef1f018cad1be511ee7d3c7
Introduce validation config file.
The config default location of the config file will be stored
in /etc/validation.cfg
The variables precedence will be the following:
* user's cli args
* config file
* default interval values
Change-Id: I05c54a43bc0a03878793cca3f51e23f4a8b63a23
By ensuring the locale is set to US utf-8 we can avoid
encoding errors.
Closes-Bug: #1940313
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I585a433e7480c22d52f402c1661194968ec66307
The 'ValidationActions.group_information' method was refactored
to reflect new signature of the 'utils.parse_all_validations_on_disk' function.
Tests were adjusted accordingly.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ic2ca556441169594792d7d5835ea057e9256a7a9
This job initiates checks defined in the 'tripleoclient.undercloud_preflight'
module, which use the 'validations_libs.validation_actions.ValidationActions' class.
Any issues, arising in the integration of the aformentioned modules,
should be detected during the job run.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I947f0bcc2d4a6152de41b1592dc51a3757f0a8af
- redundant imports in test modules were removed
- reset color code management in test simplified
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Iac5e68286782c5c2fbc185650c0bdf915fe959ef
This patch adds the Cliff Sphinx Extension support for auto documenting
the `validation` Command Line Interface. It also standardizes the
`metavar` description for all the --group, --category and --product
arguments by using <group_id>, <category_id> and <product_id>.
Moreover, it removes usage example(s) in the arguments helpers which are often
duplicated with the `metavar`.
Change-Id: I3009337e8afadd705bbee5b89d9022c78093cdc8
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
This patch adds the management of the new `products` metadata key in the
validation playbooks. We can now filter the validations by their groups,
by their categories or by their products while listing or running them.
The `list` sub command has now a new --product argument. When filtering
by groups, by categories or by products (see the example below), the
`list` sub command will return all the validation playbooks belonging to
the 'prep' group OR all the validation playbooks belonging to the 'os'
and/or 'system' categories OR all the validation playbooks to the
'tripleo' product:
$ validation list -h
$ validation list --group prep --category os,system --product tripleo
The `run` sub command has also its new --product argument. Note that
this new argument is mutually exclusive with the --validation, --group
and --category arguments:
$ validation run -h
$ validation run --product tripleo --inventory /etc/ansible/hosts
The `show parameter` sub command has the same new argument which is also
mutually exclusive with the --validation, --group and the --category
arguments:
$ validation show parameter -h
$ validation show parameter --product tripleo
Change-Id: Ief13e506c2bee18da47b31f1c2d5c0dbb1ad1ecf
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
This patch adds the management of the new `categories` metadata key in
the validation playbooks. We can now filter the validations by their
groups and/or by their categories while listing or running them.
The `list` sub command has now a new --category argument. When filtering
by groups and by categories (see the example below), the `list` sub
command will return all the validation playbooks belonging to the prep
group OR all the validation playbooks belonging to the os and/or system
categories:
$ validation list -h
$ validation list --group prep --category os,system
The `run` sub command has also its new --category argument. Note that
this new argument is mutually exclusive with the --validation and
--group arguments:
$ validation run -h
$ validation run --category networking --inventory /etc/ansible/hosts
The `show parameter` sub command has the same new argument which is also
mutually exclusive with the --validation and --group arguments:
$ validation show parameter -h
$ validation show parameter --category os,system,hardware,ram
Change-Id: I4297f83355bdd209d21518fbadb17d1343fd4680
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
openstack-tox-docs job started to fail with the following error:
! LaTeX Error: File `tgtermes.sty' not found.
This patch adds the required font package to bindep doc profile.
Co-authored-by: Elod Illes <elod.illes@est.tech>
Closes-Bug: #1938044
Change-Id: I0758890b65212b064118d7f94c04825e4a04a394
tripleo-ci-centos-8-standalone-validation-libs
should have build_container_images: true
in gate if that setting is run in check.
This review adds a vars anchor to match
vars in check and gate.
Change-Id: Iec14a28a2a4d0000c7b4c573760eaeb603004cbd
This patch removes the convert_data function which has been introduced
with the first one and deprecated Command Line Interface. The
--validation and --group arguments were sending comma-separated strings
instead of list. The new Command Line Interface is now enforcing this by
using its own CommaList Parser Action and only accepting List of groups
or validation names.
This function is now useless and can be removed safely. Tests and usages
have been modified accordingly.
Change-Id: Ief9459e914ea73fbd59a85c07a55c26078e0126a
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
Implementing a Spinner class and utilizing it around a run action. This
will add a moving icon that animates in place until output is reached,
letting the operator know that things are happening.
The interactive TTY test is included to ensure that during some unknown
usage such as logging to disk this feature doesn't spew unnecessary
clutter.
Change-Id: Ieef256a5c12b238008e9250c0ee182d80a2b6dfb
this patch improves vagrant functionality by taking advantage of the
non-root shell provisioner; namely via the privileged: false flag
previously the vagrant dev environments were lacking utility in out of
the box experience
Change-Id: Iaabe918c7eee5ac18d1ffd393f59fda568088eb5
The existing tests were using shared fakes as return value
of certain mocks. Unfortunately, while perfectly fine in most cases,
certain methods change values passed in place.
This created a race condition, which caused fluctuation in the reported
coverage of the relevant modules.
The undesirable test behavior only becomes apparent when the tests
are run in a succession and their behavior is analyzed, for example
during the run of the recently implemented 'coverchange' job.
Final statistics of the coverage measurement, displaying the totals
for number of lines, lines without coverage, branches etc., display
following pattern. Note the third column.
TOTAL 995 105 340 56 86%
TOTAL 995 105 340 56 86%
TOTAL 995 105 340 56 86%
TOTAL 995 108 340 56 86%
TOTAL 995 108 340 56 86%
TOTAL 995 105 340 56 86%
TOTAL 995 105 340 56 86%
TOTAL 995 108 340 56 86%
TOTAL 995 105 340 56 86%
Number of lines without coverage oscillates between '108' and '105' depending
on the order in which the tests were run. The culprit being one of the functions
of the 'validations_libs.cli.common' module, which edits data passed in place.
As the data processed are passed from patched object, and the data itself are
defined withing the relevant 'fakes' module, it emerges with inevitability,
that the tested code operates on data previously altered by the tests.
Furthermore the 'test_run_command_failed_validation' test was augmented
to place further assertion on the arguments passed.
Closes-Bug: #1935003
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I2210fa1775691dd503eb882a24824eaf18d7bd3e
After several weeks being a nonvoting job, the reqcheck is moving to voting status.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ie54a0d256529277a69a72334e45040070ec32dc5
The variable referenced in the logging statement
of the job was not the one on which the assertion was made.
As a result the message was confusing.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ia7b9951d5c47c13f344fc1303604018f2420c457
The 'history list' sub command is always getting the log files from the
default directory ('~/validations') even if the user decided to write
them in one other directory.
$ validation run --validation 512e \
--validation-log-dir /var/log/validations \
--inventory /etc/ansible/hosts
$ validation -vvv --debug history list \
--validation-log-dir /var/log/validations
...
FileNotFoundError: [Errno 2] No such file or directory: '/home/validations/validations'
This patch fixes this wrong behavior by passing the
--validation-log-dir argument value to the show_history actions.
Moreover, the ValidationActions class is taken validation_path and group
as parameters. Passing --validation-log-dir argument value is wrong and useless.
Change-Id: I9962d449ee507ee64d0c884199d02cd9ce786c9b
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
Redundant checks were removed an branching reduced.
Previously de-facto function _get_content now behaves as
a method should and works with attributes.
Several string processsing snippets were factored out
and are now separate helper methods.
Added check for abs path.
Changed related test to provide absolute path.
Added new test case for absolute path checking.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I46df7b4befbef36a74b9138961650806c457fc13
In stable/train Cliff version is 2.16.0 which force us
to pin validations-libs or to handle backward compat directly
in the code.
For long term solution and to avoid tagging, pinning and complex
release management this review fix the compatibility with Cliff 2.16.0
Change-Id: I6dec4c154f088e8cc6450d5d9cf2f9b407fdefdc
Zuul check for changes in unit test coverage.
With this running we can ensure that no more code is
merged without tests.
Checks both per file, and total coverage.
At this stage, I'm proposing is a non-voting job.
After a grace period, for example one sprint or two, it would become voting.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: If2e61c9bbf59e91163357023d16620934dc7d3a0
Since we only use 1 TripleO standalone job, we dont need
to run the content provided job, but only build containers
in the standalone job.
Removing the content-provider job will decrease significatively
the duration of the zuul runs
Change-Id: Ie13c85f8d80e17077d1a5b591a171248ab0eed28
The ShowGroup sub-command was not working anymore due
to a regression introduced by the new CLI next generation
commit[1].
This patch fixes the ShowGroup sub-command by addressing the
following points:
* The ValidationActions.group_information method should take
the absolute path of the groups.yaml file by default.
* Using cliff.lister.Lister base class instead of
cliff.show.ShowOne base class for the ShowGroup class.
Resolves: rhbz#1972155
[1] - 5fad1a4d18
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ia5aa3e96e8b5a6634a709ce8677f90108c80dfd3