Skip to content

Set user error if there are no eligble resource to fault in target zone. - #18

Open
arpja wants to merge 8 commits into
Azure:mainfrom
arpja:main
Open

Set user error if there are no eligble resource to fault in target zone.#18
arpja wants to merge 8 commits into
Azure:mainfrom
arpja:main

Conversation

@arpja

@arpja arpja commented Jun 3, 2026

Copy link
Copy Markdown
Member

Add skipped in job status for ineligible resources

arpja and others added 8 commits December 10, 2025 12:41
- moving scripts to canary folder
…kward compat

Changes applied to all 7 zonal fault scripts (and their Canary mirrors):

* Add [object]\ parameter accepting JSON string,
  Hashtable, or PSCustomObject (the last is what Azure Automation REST API
  produces after its single-decode of JSON parameter values).
* Keep the existing [string]\ as an optional fallback. When
  SubscriptionToTargetZone is null/empty, TargetZone is applied uniformly
  to every resource (original behavior preserved).
* If a subscription's value in SubscriptionToTargetZone is empty, the
  resource is still faulted but without zone targeting.
* New Get-ResourceTargets helper resolves the target zone for each resource
  id (looking up its subscription in the JSON dict, or falling back to
  TargetZone).
* Add per-resource Write-Verbose log line so the zone being targeted for
  each resource is visible in the runbook job stream.
* Silence the chatty Az.* module-load verbose output by pre-importing
  Az.Accounts and the resource-specific Az module at runspace scope under
  \SilentlyContinue = 'SilentlyContinue', then restoring 'Continue' so
  our own Write-Verbose logs still appear.

Verified end-to-end against AKSRunbook in Automation with both invocation
styles (SubscriptionToTargetZone wins; TargetZone-only legacy compat).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d not have eligible nodes/probes to fault in the target region.
…ing is not possible since there aren’t any resources in the selected target zone.
@arpja arpja changed the title Set 'skipped' in job status for ineligible resources Set user error if there are no eligble resource to fault in target zone. Jul 20, 2026
$err = $null
if (-not $op.IsSuccess) {
$metadata = @{ Status = $op.Status }
if ($op.Status -eq 'Skipped') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope the skipped status is returned by the $op. Please check or confirm once.

Write-Verbose "AKS zone fault completed with PartialSuccess. $skippedCount of $($AksTargetList.Count) cluster(s) had no eligible nodes to fault in the target zone (RHDSUserErrorAKSNoNodesToFaultInTargetZone)."
} else {
Write-Verbose "All AKS zone fault operations completed successfully."
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are we handling the this skipped return at the Drills code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants