POSH-LTM-Rest icon indicating copy to clipboard operation
POSH-LTM-Rest copied to clipboard

Set-Pool requires loadBalancingMode parameter

Open JeffryPaul opened this issue 2 years ago • 4 comments

The following custom code snippet fails on the line containing Set-Pool, prompting for the LoadBalancingMode parameter. This parameter was already defined with 'New-Pool', so it shouldn't prompt again on 'Set-Pool'. As a workaround, I edited Set-Pool.ps1 and removed the [ValidationSet] parameter setting. ` $Status = New-Pool -F5Session $F5Session -Name $PoolName -LoadBalancingMode "round-robin" if ($Status) { Write-Information "Pool ($($PoolName)) created"

        # Update pool with optional settings
        $NewPool = Get-Pool -F5Session $F5Session -Name $PoolName
        $NewPool.slowRampTime = $SlowRamptime
        $NewPool.serviceDownAction = $ActionOnServiceDown
        $NewPool | Set-Pool
        $NewPool | Add-PoolMonitor -Name $Monitor
        Write-Information "Pool settings updated"
    }
    else
    {
        Write-Warning "Error creating Pool ($($PoolName))"
        Break
    }

`

JeffryPaul avatar Jul 18 '23 19:07 JeffryPaul

Hi, @JeffryPaul. Sorry for the slow reply. I'm looking and this now and attempting to repro. When I use your snippet, I don't get prompted for a LoadBalancingMode parameter. The pool object being passed to the function does have a loadBalancingMode property and the function should be able to read that.

What version LTM are you connecting to?

joel74 avatar Aug 28 '23 15:08 joel74

LTM v15.1.7-0.0.6

I'm using Powershell 5.1. Should I be using Powershell 7 instead?

Jeff

From: joel @.> Sent: Monday, August 28, 2023 11:52 AM To: joel74/POSH-LTM-Rest @.> Cc: Jeff Diemer @.>; Mention @.> Subject: Re: [joel74/POSH-LTM-Rest] Set-Pool requires loadBalancingMode parameter (Issue #228)

Hi, @JeffryPaulhttps://github.com/JeffryPaul. Sorry for the slow reply. I'm looking and this now and attempting to repro. When I use your snippet, I don't get prompted for a LoadBalancingMode parameter. The pool object being passed to the function does have a loadBalancingMode property and the function should be able to read that.

What version LTM are you connecting to?

Reply to this email directly, view it on GitHubhttps://github.com/joel74/POSH-LTM-Rest/issues/228#issuecomment-1695935919, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMZA3GJR7KXNNTIKRRCD6LDXXS5DBANCNFSM6AAAAAA2O4C3QU. You are receiving this because you were mentioned.Message ID: @.@.>>

JeffryPaul avatar Aug 28 '23 16:08 JeffryPaul

Hi, @JeffryPaul , No, the version of PS shouldn't be an issue at all. I'm testing with 5.0. It's a strange one. You are using the latest version of the F5-LTM PS module? I wonder if it's not using the InputObject parameter set? I'll have to give this some more thought on how else to repro.

joel74 avatar Aug 28 '23 20:08 joel74

Hi, @JeffryPaul .

Please try this: add the following snippet to Set-Pool.ps1 at line 90 (just below " process {")

        Write-Verbose "bound params"
        foreach($psbp in $PSBoundParameters.GetEnumerator())
        {
            Write-Verbose ("Key={0} Value={1}" -f $psbp.Key,$psbp.Value)
        }

After a forced reimport of the module, set your verbose preferences to Continue and see what is printed out. I got: VERBOSE: bound params VERBOSE: Key=InputObject Value=System.Management.Automation.PSObject[] VERBOSE: Key=Partition Value=Common VERBOSE: Key=Name Value=TestPool1234

The input object has the loadBalancingMode property in it. It will be interesting to see if that shows up.

joel74 avatar Aug 31 '23 03:08 joel74