pulp_ansible
pulp_ansible copied to clipboard
[fix] Use Dynaconf lazy variables insted of re-importing the settings.
Instead of doing from dynaconf import settings
which causes the whole
settings load to be executed again, it is better to use the support for
lazy evaluation and formatting https://www.dynaconf.com/dynamic/#format-token
so it is possible to define a variable that is a template to be formed from
interpolation with other in settings variables.
So inside a settings file that is managed by dynaconf like:
from dynaconf import settings
FOO = settings.BAR + "/zaz"
It is better to do
FOO = "@format {this.BAR}/zaz"
or if Jinja powers is needed
FOO = "@jinja {{ this.BAR }}/zaz"
This way there is no need to reload all the settings and avoids circular dependencies.
[noissue]