On Tue, 2018-07-17 at 15:04 +0200, Katerina Koukiou wrote:
On Thu, Jul 12, 2018 at 05:19:27PM +0200, Andrea Bolognani wrote:
> +class Projects:
> +
> + def __init__(self):
> + try:
> + with open("./vars/mappings.yml", "r") as f:
There is clear information where how to run the lcitool in the docs
in some patches befor so the relative paths that are used everywhere in
the code are not causing a problem.
Though IMO, I think it's clearer to have a variable (config
option, hardcoded, env variable or whatever you decide), storing the path of
these files so that this code is not dependent on relative paths. WDYT?
Some of the paths, like vars/mappings.yml, are pretty much entirely
arbitrary but others, like group_vars/all/main.yml, can't be changed
because that's what Ansible expects.
Additionally, none of the paths is repeated more than once in the
script so using something like
mappings_path = "./vars/mappings.yml"
open(mappings_path, "r")
instead of
open("./vars/mappings.yml", "r")
wouldn't IMHO buy us much.
--
Andrea Bolognani / Red Hat / Virtualization