joel74 / POSH-LTM-Rest

PowerShell module and scripts for working with F5's LTM REST API
MIT License
78 stars 49 forks source link

Disable-PoolMember Fails When Omitting the PoolName #152

Closed Baalakay closed 6 years ago

Baalakay commented 6 years ago

According to the cmdlet, omitting the pool name with Disable-PoolMember should disable the member in all pools. Similarly with Enable-PoolMember.

However I receive the following error.

PS F:> Disable-PoolMember -Address 10.1.166.159 Disable-PoolMember : Parameter set cannot be resolved using the specified named parameters. At line:1 char:1

Also, I tried to use the -PoolMember parameter instead of -Address but it doesn't work and I get no return msg. In the LTM, 10.1.166.159:0 is listed as the "member" but the FQDN is empty. Does the "disable all members without a pool name" functionality work only with the -PoolMember parameter and does that require the FQDN?

PS F:> Disable-PoolMember -PoolMember 10.1.166.159 PS F:> Disable-PoolMember -PoolMember 10.1.166.159:0

Thanks.

vercellone commented 6 years ago

It wasn't written to handle that scenario. But you should be able to Get-Pool ... | Disable-PoolMember... Have you tried that?

springcm-ci-build commented 6 years ago

True, it should work by calling Get-PoolMember and passing the returned object via pipeline to Disable-PooMember, but I'm getting a return value of False for that. I'll take a closer look.

Baalakay commented 6 years ago

Thanks, this worked for me and disabled the member in all pools.

Get-Pool | Disable-PoolMember -Address 10.1.166.159

joel74 commented 6 years ago

That's great that it works, but I think it should work differently. We should be able to get the pool member, not the entire pool, and pass that. I'm still going to look into that.

Baalakay commented 6 years ago

That's what I was thinking too Joel. I've re-opened it.

joel74 commented 6 years ago

I retested, and now it seems to work fine. I'm not sure what I was doing wrong before. You definitely need to get the pool member via Get-PoolMember and pass that object via the pipeline to Disable-PoolMember. It won't work to only pass the IP address. I test on v13 with a member in multiple pools, and it correctly disabled the member in all the pools it was in.

Baalakay commented 6 years ago

Joel, what parameter did you use when you are selecting only one pool member? -PoolMember? And if so, our pool member's name is the IP address. If I use the below it doesn't do anything. Curious how you are passing the member name in. If you are using -PoolMember, can you setup a member in the pool with the IP address as the member name and see if it works for you as below?

Disable-PoolMember -PoolMember 10.1.166.159:0

joel74 commented 6 years ago

Baalakay, it's fine that your pool members' names are their IP addresses. Here's what you need to do: Get-PoolMember -Address 10.1.166.159:0 | Disable-PoolMember

In this snippet, you're passing an object, not a name, to Disable-PoolMember.

joel74 commented 6 years ago

I updated the instructions for Disable-PoolMember, to help clarify this issue.

Baalakay commented 6 years ago

Ok, so both of these methods work:

Get-PoolMember -Address 10.1.166.159 | Disable-PoolMember Get-Pool | Enable-PoolMember -Address 10.1.166.159

Thanks for the quick replies everyone and thanks for the awesome module!

By the way, is there a cmdlet to clear sticky persistence records?

Thanks.

joel74 commented 6 years ago

You're welcome. Thanks for using it. Nope, we haven't done anything yet working with persistence on virtual servers. Feel free to open an issue for that. I think we can consider this issue closed.