Commit 4b3f70b
Validate and normalize instance state configuration
Adds validation for the `aws_ec2_instance_states` configuration to
ensure only valid EC2 instance state names are used. The validation
filters out invalid states and logs a warning, allowing the node to
start with the valid states.
The `validate_instance_states/1` function checks each configured state
against the list of valid EC2 instance states defined in the
`?VALID_EC2_INSTANCE_STATES` macro. Invalid states are discarded and
logged as a warning.
The `normalize_state/1` function handles both atom and string inputs,
converting atoms to strings for consistent handling. This supports
configuration via `advanced.config` with atoms (`[running, pending]`)
or via `rabbitmq.conf` with strings (`["running", "pending"]`).
Tests verify validation works correctly for:
- All valid states (strings)
- Mixed valid and invalid states (filters out invalid)
- Atom inputs (normalizes to strings)
- Mixed valid and invalid atoms
(cherry picked from commit 41d5030)1 parent 12696c9 commit 4b3f70b
2 files changed
Lines changed: 35 additions & 1 deletion
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
321 | 323 | | |
322 | 324 | | |
323 | 325 | | |
324 | | - | |
| 326 | + | |
| 327 | + | |
325 | 328 | | |
326 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
327 | 352 | | |
328 | 353 | | |
329 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
67 | 76 | | |
68 | 77 | | |
69 | 78 | | |
| |||
0 commit comments