saltstack-formulas / dhcpd-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
8 stars 56 forks source link

Allow hosts to be specified for subnet as well #29

Closed aaannz closed 5 years ago

aaannz commented 6 years ago

This allows host entries to be defined under subnet.

0xf10e commented 6 years ago

Oh, nice! :+1:

aaannz commented 5 years ago

Anything more I can do to be this accepted?

myii commented 5 years ago

@aaannz Sorry for the long delay. @baby-gnu has offered to have a look at this on Monday.

baby-gnu commented 5 years ago

The change is not trivial, I'm trying to figure out how to test that ;-)

baby-gnu commented 5 years ago

Note that I bugged on {{ intendation }}, it should be {{ indentation }}.

It can be fixed in another PR.

Regards.

aaannz commented 5 years ago

Thank you for the review. I changed it based on your feedback, including change for intendation to indentation in last commit.

baby-gnu commented 5 years ago

Thank you for the review. I changed it based on your feedback, including change for intendation to indentation in last commit.

Thanks a lot. I'm looking at Jinja2 documentation to find a better way of doing indentation of included files. We can't do {% include 'foo.jinja' with context | indent(width=2) %}

Let's get that merged for now, I'll do a dedicated PR for the indent optimization.

myii commented 5 years ago

Thanks for your patience and fast response @aaannz.

@baby-gnu Thanks for taking the time to review. A common way I've found indent being done in our formulas can be seen from this search:

I.e. something like:

{%- macro do_something(width=4) %}
{%-   filter indent(width) %}
...
{%-   endfilter %}
{%- endmacro %}
baby-gnu commented 5 years ago

A common way I've found indent being done in our formulas can be seen from this search:

Thanks @myii, I think I found a better way:

{%- filter indent(width=4) %}
{%- include "./sub-template.yml.j2" %}
{%- endfilter %}

I'm making tests to take care of the first line and how to manage spaces.

Regards.