Skip to content

Wait-NBBranch

Since

v4.5.7.0

SYNOPSIS

Waits for a Netbox branch to reach a target status.

SYNTAX

ById (Default)

Wait-NBBranch -Id <UInt64> [-TargetStatus <String>] [-TimeoutSeconds <Int32>] [-PollIntervalMs <Int32>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

ByName

Wait-NBBranch -Name <String> [-TargetStatus <String>] [-TimeoutSeconds <Int32>] [-PollIntervalMs <Int32>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Polls a branch via the Netbox Branching plugin until it reaches a specified target status (default: 'ready'), fails, reaches a different terminal status, or the timeout is exceeded. Accepts pipeline input from New-NBBranch so you can provision a branch and block until it is safe to use, avoiding the race condition where a branched schema is queried before the plugin has finished provisioning it.

Status lifecycle handled by this function:

  • Transitional (keep polling): new, provisioning, syncing, migrating, merging, reverting
  • Terminal "ok" (valid targets): ready, merged, archived
  • Terminal "working": pending-migrations (will fail fast if hit while waiting for another target)
  • Terminal failure: failed (always throws)

EXAMPLES

EXAMPLE 1

New-NBBranch -Name "feature/new-datacenter" | Wait-NBBranch | Enter-NBBranch

Create a branch, wait until provisioning completes, then enter its context.

EXAMPLE 2

Sync-NBBranch -Id 42 -Confirm:$false Wait-NBBranch -Id 42 -TimeoutSeconds 300

Sync a branch with main and wait up to 5 minutes for the sync to finish.

EXAMPLE 3

Merge-NBBranch -Id 42 -Confirm:$false Wait-NBBranch -Id 42 -TargetStatus merged

Merge a branch and wait for the merge to complete.

EXAMPLE 4

New-NBBranch -Name 'probe' | Wait-NBBranch -Timeout 60 | Invoke-NBInBranch { Get-NBDCIMDevice }

Provision a branch, wait for it, and immediately run a query inside it.

PARAMETERS

-Id

The ID of the branch to wait on. Accepts pipeline input by property name, so a branch object from New-NBBranch binds automatically.

```yaml Type: UInt64 Parameter Sets: ById Aliases:

Required: True Position: Named Default value: 0 Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ```

-Name

The name of the branch to wait on. Resolved to an ID on the first poll.

```yaml Type: String Parameter Sets: ByName Aliases:

Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```

-TargetStatus

The status to wait for. Default: 'ready'. Valid values: 'ready', 'merged', 'archived'.

```yaml Type: String Parameter Sets: (All) Aliases:

Required: False Position: Named Default value: Ready Accept pipeline input: False Accept wildcard characters: False ```

-TimeoutSeconds

Maximum number of seconds to wait before throwing a timeout error. Default: 120.

```yaml Type: Int32 Parameter Sets: (All) Aliases:

Required: False Position: Named Default value: 120 Accept pipeline input: False Accept wildcard characters: False ```

-PollIntervalMs

Poll interval in milliseconds between status checks. Default: 1000.

```yaml Type: Int32 Parameter Sets: (All) Aliases:

Required: False Position: Named Default value: 1000 Accept pipeline input: False Accept wildcard characters: False ```

-ProgressAction

{{ Fill ProgressAction Description }}

```yaml Type: ActionPreference Parameter Sets: (All) Aliases: proga

Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

[PSCustomObject] The fully-resolved branch object once it reaches the

target status.

NOTES

AddedInVersion: v4.5.7.0

Common parameters

common request params

New-NBBranch Get-NBBranch Enter-NBBranch Sync-NBBranch Merge-NBBranch