Skip to content

Commit

Permalink
Update Get-PoolsForMember.ps1
Browse files Browse the repository at this point in the history
Pool members may not have IP addresses assigned and use a value of "any6". Since this is not a discrete IP address, Get-PoolsForMember will fail to return the correct results when a pool member object is passed in. Since pool member names must be unique, I added -Name as a param and use that instead of Address when the pool member object is passed.
  • Loading branch information
joel74 committed Aug 22, 2022
1 parent 54ad019 commit f4f3029
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions F5-LTM/Public/Get-PoolsForMember.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Function Get-PoolsForMember {
<#
.SYNOPSIS
Determine which pool(s) a pool member is in. Expects either a pool member object or an IP address to be passed as a parameter
Determine which pool(s) a pool member is in. Expects either a pool member object, an IP address, or a pool member name to be passed as a parameter
.EXAMPLE
#Get all pools that 'member1' pool member is in
Get-poolmember -Name 'member1' | Get-PoolsForMember
Expand All @@ -15,7 +15,10 @@
[PSObject]$InputObject,

[Parameter(Mandatory=$false,ParameterSetName='Address')]
[PoshLTM.F5Address[]]$Address=[PoshLTM.F5Address]::Any
[PoshLTM.F5Address[]]$Address=[PoshLTM.F5Address]::Any,

[Parameter(Mandatory=$false,ParameterSetName='Name')]
[String]$Name
)
begin {
#Test that the F5 session is in a valid format
Expand All @@ -32,6 +35,15 @@
}
}
}
Name {
$pools = Get-Pool -F5Session $F5Session
foreach ($pool in $pools) {
$members = $pool | Get-PoolMember -F5session $F5Session | Where-Object { $_.name -eq $Name }
if ($members) {
$pool
}
}
}
InputObject {
foreach($member in $InputObject) {
Get-PoolsForMember -F5Session $F5Session -Address $member.address
Expand Down

0 comments on commit f4f3029

Please sign in to comment.