Closed pvoborni closed 2 years ago
I've added also the remaining features + to fixes to address some crashes. I only unit-tested the PR.
feat(ansible-inventory): host arbitrary attributes
Adding a possibility to add arbitrary attributes to host part of
generated Ansible inventory via defining them per-host in new dictonary
ansible_inventory
.
This is useful for creating more complex jobs which are using ansible playbooks or roles requiring to get vars from hosts.
fix(pytest-multihost): crash when group is not defined
It should possible to define host groups either via "group" or "groups" variable. But pytest-multihost output was crashing when it was done via "groups".
This fix makes it not to crash if both are missing. It also makes it possible to use first group from "groups" if groups are defined - similar as in Ansible inventory output.
fix(pytest-multihost): crash when mhcfg is missing in prov. config
mhcfg
is not required key in provisinong config, but pytest-multihost
plugin crashes if it is missing. This fix makes it not crash.
feat(pytest-multihost): arbitrary attributes for hosts
Make it possible to add arbitrary attributes per-host via defining them in pytest_multihost dictionary in host section of job metadata file.
First of all thanks for the patches!
I have checked the code and it look good to me. The small nitpick as we decided to go with the _
underscore the commit messages are well with -
(feat(ansible-inventory)
) i do not mind but if you are wiling to rewrite and it makes sense to you as well please rewrite it.
I will test this and the bugs you found and provide feedback !
For the commit message summary lines, e.g., feat(ansible-inventory
. It should not reflect the dictionary name. It supposed to refer to the whole ansible inventory output - as a component. But I think we did not agree on any specific names of the mrack components. Thus I'd leave it be.
I totally agree :)
Make it possible to define arbitratry attributes prefix with meta_ in host section of job metadata file.
All of these attributes are then copied to host part in ansible inventory output.
It can serve for creation of playbooks which consumes these attributes.
Addtional, but probably rare use case, is to override the meta_ attrs which are derived from other others by mrack.
Signed-off-by: Petr Vobornik pvoborni@redhat.com