Switch to Python's logging

Also a bit of cleanup of _run_internal Simplify the tests accordingly.

The MR is intentionally not introducing significant changes in the expected output in the tests to make reviewing easier and ensure there has been no logic changes in auto schema itself.

Output example:

| 2026-05-05 13:44:57.759622 db-mysql db2209 -N -e "show slave hosts;"                                                                                                                                                      |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 2026-05-05 13:44:58 INFO Downtiming db2209 for 12 hours                                                                                                                                                                   |
| 2026-05-05 13:44:58.027680 cookbook sre.hosts.downtime --hours 12 -r "Maintenance" db2209.codfw.wmnet                                                                                                                     |
| 2026-05-05 13:45:14 DEBUG [stderr] Acquired lock for key /spicerack/locks/cookbooks/sre.hosts.downtime: {'concurrency': 20, 'created': '2026-05-05 13:45:00.264831', 'owner': 'fceratto@cumin1003 [234477]', 'ttl': 1800} |
| 2026-05-05 13:45:14 DEBUG [stderr] START - Cookbook sre.hosts.downtime for 12:00:00 on db2209.codfw.wmnet with reason: Maintenance                                                                                        |
| 2026-05-05 13:45:14 DEBUG [stderr] Downtiming for 12:00:00 on db2209.codfw.wmnet with reason: Maintenance                                                                                                                 |
| 2026-05-05 13:45:14 DEBUG [stderr] Scheduling downtime on Icinga server alert1002.wikimedia.org for hosts: db2209                                                                                                         |
| 2026-05-05 13:45:14 DEBUG [stderr] [1/12, retrying in 10.00s] Unable to verify all hosts got downtimed: Some hosts are not yet downtimed: ['db2209']                                                                      |
| 2026-05-05 13:45:14 DEBUG [stderr] Created silence ID e5363fa7-9486-41d5-83dd-5acdc23edd64                                                                                                                                |
| 2026-05-05 13:45:14 DEBUG [stderr] Released lock for key /spicerack/locks/cookbooks/sre.hosts.downtime: {'concurrency': 20, 'created': '2026-05-05 13:45:00.264831', 'owner': 'fceratto@cumin1003 [234477]', 'ttl': 1800} |
| 2026-05-05 13:45:14 DEBUG [stderr] DONE (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 12:00:00 on db2209.codfw.wmnet with reason: Maintenance                                                                    |
| 2026-05-05 13:45:14 INFO Depooling db2209                                                                                                                                                                                 |
| 2026-05-05 13:45:14.691012 dbctl instance db2209 depool                                                                                                                                                                   |
| 2026-05-05 13:45:20 DEBUG [stdout] codfw/sectionLoads/DEFAULT live                   codfw/sectionLoads/DEFAULT generated                                                                                                 |
| 2026-05-05 13:45:20 DEBUG [stdout]         "db2149": 300,                                    "db2149": 300,                                                                                                               |
| 2026-05-05 13:45:20 DEBUG [stdout]         "db2156": 300,                                    "db2156": 300,                                                                                                               |
| 2026-05-05 13:45:20 DEBUG [stdout]         "db2177": 100,                                    "db2177": 100,                                                                                                               |
| 2026-05-05 13:45:20 DEBUG [stdout]         "db2190": 300,                                    "db2190": 300,                                                                                                               |
| 2026-05-05 13:45:20 DEBUG [stdout]         "db2194": 300,                                    "db2194": 300,                                                                                                               |
| 2026-05-05 13:45:20 DEBUG [stdout]         "db2209": 300,                                                                                                                                                                 |
| 2026-05-05 13:45:20 DEBUG [stdout]         "db2227": 300                                     "db2227": 300                                                                                                                |
| 2026-05-05 13:45:20 DEBUG [stdout]     }                                                 }                                                                                                                                |
| 2026-05-05 13:45:20 DEBUG [stdout] ]                                                                                                                                                                                      |

Bug: T302207

Edited by Federico Ceratto

Merge request reports

Loading