Commit baddfa8
config path: robustly remove config serials with read-only dirs
Since 2.5.0b1 every config activation snapshots $OMD_ROOT/local into
the new helper config serial (helper_config/<serial>/local). The copy
is made with shutil.copytree, which preserves permission bits.
On sites where the local/ hierarchy is intentionally read-only (e.g.
because it is distributed centrally), the snapshot therefore contains
directories without write permission. The next cleanup_old_configs run
then crashes with PermissionError when removing an outdated serial,
because on POSIX a directory must be writable to unlink its children.
This aborts config activation.
Restore permissions on the directories of the serial's tree and retry
when the removal hits a PermissionError. Only directory permissions
matter for deletion; symlinks are skipped so no permissions outside
the tree can be changed. Use the same robust removal for the stale
under-construction serial in create(), which has the same failure
mode.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 48d770d commit baddfa8
2 files changed
Lines changed: 47 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
96 | 117 | | |
97 | 118 | | |
98 | 119 | | |
| |||
123 | 144 | | |
124 | 145 | | |
125 | 146 | | |
126 | | - | |
| 147 | + | |
127 | 148 | | |
128 | 149 | | |
129 | 150 | | |
| |||
138 | 159 | | |
139 | 160 | | |
140 | 161 | | |
141 | | - | |
| 162 | + | |
142 | 163 | | |
143 | 164 | | |
144 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
196 | 220 | | |
197 | 221 | | |
198 | 222 | | |
| |||
0 commit comments