saltstack-formulas / dhcpd-formula

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

refactor(map): refactor map.jinja #43

Closed sticky-note closed 4 years ago

sticky-note commented 4 years ago

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Refactor Map.jinja and templates

Primary type

Secondary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Describe the changes you're proposing

Pillar / config required to test the proposed changes

Debug log showing how the proposed changes work

Documentation checklist

Testing checklist

Additional context

myii commented 4 years ago

@sticky-note This is going to be tricky to review because there is a lot going on in one PR, especially with everything squashed down into one commit. What I mean is that there are at least two separate activities here:

  1. Replacing the old map.jinja with the new style from the template-formula.
  2. Modifying all of the pillar.get calls to use the newly produced map.

Looking at the first point, we've also been having numerous discussions about our relationship with merging pillars into the map. Refer back to these links for more info:

That part that is relevant to this PR: essentially we have three methods used across all of the formulas in this org:

  1. Merge only the pillar lookup.
  2. Merge the whole pillar.
  3. Merge the lookup first and then the whole pillar on top.

So prior to this PR, this formula was method 1. This PR is changing it to method 3. We introduced method 3 in the first place to be a "catch-all" that worked with all formulas, but that doesn't look like a good idea going forward. We may end up maintaining method 1 as the ideal and there's a PR in progress that will allow us to choose the right option per formula:

So what does that mean here? I don't want you to lose your work but I will need you to split it for now, to make it easier to review and merge. There was a PR in the zabbix-formula recently, where I had to adjust the proposed change to map.jinja to only merge the lookup:

Once we get that first refactor merged in, we can look at the rest of the changeset that you're proposing here.