swalberg / f5-icontrol

A SOAP interface and CLI tool for the F5 appliance
MIT License
12 stars 16 forks source link

Unable to get pool members from RAPI #20

Closed jimbodragon closed 5 years ago

jimbodragon commented 5 years ago

Greetings, I'm using f5-icontrol 0.3.2 with F5 12.1.0 and 11.5.1 and I'm not able to fetch the members of a pool because we use underscore ( _ ) in our pool name and when I do "pool_members.load", it return me "404 Not Found". By changing the private method «url» from the class RAPI to not change the underscore for a dash, it works perfectly.

Do you change that character for a particular reason? Is it possible to disable the character replacement for method_chain when it is a call for members?

P.s.

Thanks.

swalberg commented 5 years ago

Hi there Jimmy,

The commit message for 4182f7de says

Methods like /foo-bar/ can be called with foo_bar

So I made the (rather incorrect) assumption that people were like us and used dashes.

Can you give me a quick code sample to show what you're doing please? I need to go read up on this as it's been a while.

jimbodragon commented 5 years ago

Actually, I just try to list the members of a pool as we have several F5 system in our infrastructure, I need to made some clean up that I planned to do it later.

Here my code:

f5 = F5::Icontrol::RAPI.new username: 'admin', password: 'password', host: 'big_ip_system'

pools = f5.mgmt.tm.ltm.pool.get_collection

pools_hash = Hash.new
pools.each do |pool|
  pools_hash[pool.name] = Hash.new
  pools_hash[pool.name]["pool"] = pool
  pools_hash[pool.name]["members"] = pool.members.load
  pools_hash[pool.name]["members"].each do |member|
    puts "#{pool.name}, #{member.name}"
  end
end
mattlqx commented 5 years ago

Bummer, we're using underscores in our pool names as well.

(sorry for the push spam below)