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

2020-02-19 Thread Mike DePaulo
Yeah, I agree. We can change it later if need be.

On Wed, Feb 19, 2020 at 10:37 AM David Davis  wrote:

> That seems simple/easy for right now.
>
> David
>
>
> On Wed, Feb 19, 2020 at 10:13 AM Dennis Kliban  wrote:
>
>> On Wed, Feb 19, 2020 at 9:39 AM Dennis Kliban  wrote:
>>
>>> On Wed, Feb 19, 2020 at 9:22 AM Bruno Rocha 
>>> 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 
 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@redhat.com
> https://www.redhat.com/mailman/listinfo/pulp-dev
>
 ___
>> Pulp-dev mailing list
>> Pulp-dev@redhat.com
>> https://www.redhat.com/mailman/listinfo/pulp-dev
>>
> ___
> Pulp-dev mailing list
> Pulp-dev@redhat.com
> https://www.redhat.com/mailman/listinfo/pulp-dev
>


-- 

Mike DePaulo

He / Him / His

Service Reliability Engineer, Pulp

Red Hat 

IM: mikedep333

GPG: 51745404

___
Pulp-dev mailing list
Pulp-dev@redhat.com
https://www.redhat.com/mailman/listinfo/pulp-dev


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

2020-02-19 Thread David Davis
That seems simple/easy for right now.

David


On Wed, Feb 19, 2020 at 10:13 AM Dennis Kliban  wrote:

> On Wed, Feb 19, 2020 at 9:39 AM Dennis Kliban  wrote:
>
>> On Wed, Feb 19, 2020 at 9:22 AM Bruno Rocha 
>> 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 
>>> 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@redhat.com
 https://www.redhat.com/mailman/listinfo/pulp-dev

>>> ___
> Pulp-dev mailing list
> Pulp-dev@redhat.com
> https://www.redhat.com/mailman/listinfo/pulp-dev
>
___
Pulp-dev mailing list
Pulp-dev@redhat.com
https://www.redhat.com/mailman/listinfo/pulp-dev


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

2020-02-19 Thread Dennis Kliban
On Wed, Feb 19, 2020 at 9:39 AM Dennis Kliban  wrote:

> On Wed, Feb 19, 2020 at 9:22 AM Bruno Rocha 
> 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 
>> 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@redhat.com
>>> https://www.redhat.com/mailman/listinfo/pulp-dev
>>>
>>
___
Pulp-dev mailing list
Pulp-dev@redhat.com
https://www.redhat.com/mailman/listinfo/pulp-dev


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

2020-02-19 Thread Dennis Kliban
On Wed, Feb 19, 2020 at 9:22 AM Bruno Rocha  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.


> 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  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@redhat.com
>> https://www.redhat.com/mailman/listinfo/pulp-dev
>>
>
___
Pulp-dev mailing list
Pulp-dev@redhat.com
https://www.redhat.com/mailman/listinfo/pulp-dev


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

2020-02-19 Thread Dennis Kliban
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@redhat.com
https://www.redhat.com/mailman/listinfo/pulp-dev