Commit fdf2a44
committed
feat(config): move patroni template into the lib as one substrate-conditional template
The two charms each carried their own templates/patroni.yml.j2 and the config
manager loaded it with a CWD-relative open(), so the lib could not own the
render. Merge both copies into a single template the lib ships and loads as
package data, so the charms delete their copies in the adoption PR and the
template travels with the code that renders it rather than with each charm's
working directory.
The VM and K8s templates diverge in section ordering, whole blocks (raft,
bypass_api_service, pod_ip), path variables, and pg_hba rules, so the merged
template branches at the top level on a substrate context var with each
substrate's body kept verbatim. That guarantees byte-for-byte identical output
per substrate and avoids interleaving conditionals that could silently shift a
byte. render_patroni_yml_file now loads the template via importlib.resources and
passes the substrate the template branches on.
Golden tests render the merged template against byte copies of each charm's
original template across the full matrix of conditional dimensions (tls,
connectivity, ldap, restore/pitr, slots, peers, watcher, extra replication
endpoints, tags) and assert equality, so any divergent byte fails the suite.
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>1 parent a7ee622 commit fdf2a44
7 files changed
Lines changed: 1157 additions & 5 deletions
File tree
- single_kernel_postgresql
- managers
- templates
- tests
- fixtures
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
381 | 382 | | |
382 | 383 | | |
383 | 384 | | |
384 | | - | |
385 | | - | |
386 | | - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
387 | 393 | | |
388 | 394 | | |
| 395 | + | |
389 | 396 | | |
390 | 397 | | |
391 | 398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments