Skip to content

fix: Handle null undrainable_node_behavior in precondition validation#762

Open
raman1236 wants to merge 1 commit intoAzure:mainfrom
raman1236:fix/undrainable-node-behavior-null-760
Open

fix: Handle null undrainable_node_behavior in precondition validation#762
raman1236 wants to merge 1 commit intoAzure:mainfrom
raman1236:fix/undrainable-node-behavior-null-760

Conversation

@raman1236
Copy link
Copy Markdown

Fixes #760

Description

When upgrade_settings.undrainable_node_behavior is explicitly set to null, the contains() function in the precondition validation fails with:

Error: Invalid function argument
│ Invalid value for "value" parameter: argument must not be null.

This happens because try(each.value.upgrade_settings.undrainable_node_behavior, "") succeeds (the attribute exists, it's just null), so contains() receives null instead of a string.

Fix

Wrap the entire contains() call in try(..., false) so that if the value is null, the function call fails gracefully and the precondition evaluates to false — but since the middle condition (== null) already short-circuits, this branch is only reached for non-null values.

Testing

Validated that:

  • undrainable_node_behavior = null → no error (short-circuits at middle condition)
  • undrainable_node_behavior = "Cordon" → passes validation
  • undrainable_node_behavior = "invalid" → fails with proper error message

Fixes Azure#760

When upgrade_settings.undrainable_node_behavior is explicitly set to
null, the contains() function fails because it cannot accept null as
the value parameter. Wrapping the contains() call in try() handles
this case gracefully.
@raman1236 raman1236 force-pushed the fix/undrainable-node-behavior-null-760 branch from 44c4ee0 to 9d0188b Compare May 1, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

undrainable_node_behavior validation fails when set to null

1 participant