Skip to content

Commit a285325

Browse files
Fixed improperly nested engine_config arguments in PG DB creation
1 parent ff292fc commit a285325

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

linodecli/api_request.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,30 @@ def _build_request_body(
359359

360360
expanded_json = {}
361361

362-
# Expand dotted keys into nested dictionaries
362+
# Keys under `engine_config.pg` that should stay flat at one level deep
363+
flat_pg_keys = {
364+
"pg_partman_bgw.interval",
365+
"pg_partman_bgw.role",
366+
"pg_stat_monitor.pgsm_enable_query_plan",
367+
"pg_stat_monitor.pgsm_max_buckets",
368+
"pg_stat_statements.track",
369+
}
370+
363371
for k, v in vars(parsed_args).items():
364372
if v is None or k in param_names:
365373
continue
366374

375+
# If the key starts with the prefix "engine_config.pg" and is one
376+
# of the keys to remain flat, do not nest
377+
if k.startswith("engine_config.pg."):
378+
remainder = k[len("engine_config.pg.") :]
379+
if remainder in flat_pg_keys:
380+
expanded_json.setdefault("engine_config", {}).setdefault(
381+
"pg", {}
382+
)[remainder] = v
383+
continue
384+
385+
# Expand dotted keys into nested dictionaries (default)
367386
cur = expanded_json
368387
for part in k.split(".")[:-1]:
369388
if part not in cur:

0 commit comments

Comments
 (0)