[Pulp-dev] switch from Python to JSON settngs file

Dennis Kliban dkliban at redhat.com
Wed Feb 19 15:12:51 UTC 2020


On Wed, Feb 19, 2020 at 9:39 AM Dennis Kliban <dkliban at redhat.com> wrote:

> On Wed, Feb 19, 2020 at 9:22 AM Bruno Rocha <rochacbruno at redhat.com>
> wrote:
>
>> From the issue:
>>
>> Writing aws_default_acl: None in the pulp_settings variable gets
>>> rendered to AWS_DEFAULT_ACL = "None", not AWS_DEFAULT_ACL = None
>>>
>>
>> As TOML does not allow `null` values dynaconf has a special syntax for
>> expressing that:
>> https://dynaconf.readthedocs.io/en/latest/guides/environment_variables.html#precedence-and-type-casting
>>
>> aws_default_acl: "@none None" might be a workaround.
>>
>>
> Thank you Bruno! Could you please comment on the issue?
>
> This should resolve the issue that I linked in my original email.
> However,there is still a problem when the setting value is a list or a
> dictionary. The template needs to be much more robust to handle that. It
> still makes sense to switch to JSON.
>

The other option is to make no change at all and simply add documentation
that says you can provide values to ansible-pulp in the same format as you
would using environment variables. In that case everything can be treated
as a string and Dynaconf interprets it into Python at runtime. I am leaning
toward this option.


>
>
>> Also there is an issue opened regarding the YAML null values:
>> https://github.com/rochacbruno/dynaconf/issues/288
>>
>>
>> On Wed, Feb 19, 2020 at 10:57 AM Dennis Kliban <dkliban at redhat.com>
>> wrote:
>>
>>> ansible-pulp currently tries to generate a Python settings file.from
>>> settings provided by the user in the playbook[0]. However, the generated
>>> Python code is not always syntactically correct[1].
>>>
>>> The settings file is generated using a Jinja template. Jinja provides a
>>> to_json that can be used to generate the settings as JSON. I propose that
>>> we change the behavior of ansible-pulp to generate settings.json instead of
>>> settings.py.
>>>
>>> Are there any objections or other ideas?
>>>
>>> [0]
>>> https://github.com/pulp/ansible-pulp/blob/master/roles/pulp/templates/settings.py.j2
>>> [1] https://pulp.plan.io/issues/5687
>>>
>>> _______________________________________________
>>> Pulp-dev mailing list
>>> Pulp-dev at redhat.com
>>> https://www.redhat.com/mailman/listinfo/pulp-dev
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-dev/attachments/20200219/9133fe92/attachment.htm>


More information about the Pulp-dev mailing list