infobloxopen / infoblox-client

Infoblox NIOS Python WAPI Client
Apache License 2.0
141 stars 105 forks source link

0.4.22 is not working with ansible 2.6 and higher #226

Closed Udayendu closed 5 years ago

Udayendu commented 5 years ago

infoblox-client 0.4.22 is working perfectly upto ansible 2.5. But from ansible 2.6 onwards its giving the following error upto ansible 2.8:


No handlers could be found for logger "infoblox_client.connector"

Logs when not working: https://paste.fedoraproject.org/paste/ZNQzYr7Y35-kczHEkFMETA/raw Logs when working: https://paste.fedoraproject.org/paste/YJy8JTJIJCDfA-QARlOKtw

I was trying to test the 'exclude' features added to 'nios_next_ip' from ansbile 2.7 . But after upgrading ansible from 2.5 to 2.7, its not working atall.

saiprasannasastry commented 5 years ago

can you test 0.4.21 with ansible 2.6/2.7?

Udayendu commented 5 years ago

can you test 0.4.21 with ansible 2.6/2.7?

Already tried and the error is same. But its working with 2.5 perfectly. After trying with 0.4.21 I upgraded the infoblox-client to 0.4.22 . Thats why I am suspecting some compatibility issue is there between infoblox-client and ansible 2.6 and higher.

saiprasannasastry commented 5 years ago

@JonasKs do you have any idea what would have caused the issue(also can you check this #214 ) @Udayendu can you raise a bug on our ansible page, i have not worked on ansible

Udayendu commented 5 years ago

I have opened the following Bugzilla:

https://github.com/ansible/ansible/issues/60465

saiprasannasastry commented 5 years ago

you're saying 0.4.22 is working fine with anisible 2.5 but not 2.6/7/8 , i think it should be something from anisble side, i will also try to keep a track on that bug

Udayendu commented 5 years ago

you're saying 0.4.22 is working fine with anisible 2.5 but not 2.6/7/8 , i think it should be something from anisble side, i will also try to keep a track on that bug

Sure. Also I found one interesting things.

Let say in one /24 subnet I have 10 free IP but while running the playbook I am trying to search 11, then its breaking. And if I have 100 free IP and I am trying to search something more than 20 its breaking. But if 100 free IPs are there and I am trying to search upto 20, its working with ansible 2.5 version. With higher version its still breaking. Which is really strange.

I will do bit more experiment on that and will update you. We have opened a ticket with Infoblox support team to upgrade our infoblox devices. I think some old drivers are are causing the issue but not sure though.

yuewko commented 5 years ago

@Udayendu , is it possible to collect diagnostics from the infoblox-client module itself?

(Sorry if it's a dumb question - Ansible is foreign to me)

JonasKs commented 5 years ago

I don't use Ansible, so I'm not the person to go to here. I just had some beers so didn't do too much of a deep dive, but I decided to have a quick look. I'll take @Udayendu's word for that it works fine in 2.5, but not 2.6.

2.5 and 2.6's only difference is this commit, and on the class called, the difference is slim too: 2.5 and 2.6.

Other things that happened was: Update from WAPI v1.4 to 2.1, a bugfix

So, nothing obvious to me at this point in regards of code changes, but the huge bump in WAPI version is sticking out. It's this line raising the error, so I assume it's a change in how the request is done between the versions. I'll have to look into how that exact query has been different in version 1.4 and 2.1 to troubleshoot (but I'm not at work right now).


I am trying to search something more than 20 its breaking.

I'm pretty sure the next_available_ip takes a number from 1-20. This means anything above will break. I can confirm tomorrow when I'm at work.

EDIT: Rephrasing - I blame the 🍻 EDIT2: If what I suspect is the issue (I'll confirm tomorrow), I'll raise a PR to Ansible to fix the issue, of course. EDIT3: Ended up drinking beer with my colleagues, so pushing this to tomorrow. Sorry 😅

JonasKs commented 5 years ago

I wrote a reply in https://github.com/ansible/ansible/issues/60465, the playbooks works fine for me, so it's probably just @Udayendu on a really old version of Infoblox, which don't have WAPI 2.1, making it break.

Update your Infoblox and things will work.


I am trying to search something more than 20 its breaking.

What I said above was true. The requested number of networks must be between 1 and 20.

I think this ticket can be closed.

yuewko commented 5 years ago

@JonasKs , thanks for looking into it and sharing your finding!

@Udayendu , please confirm @JonasKs finding so we can dispose of this issue accordingly.

JonasKs commented 5 years ago

No worries. This can be solved by setting the WAPI version to 1.4 in the playbook too, if upgrading Infoblox is not possible.

Udayendu commented 5 years ago

Hi @JonasKs

As updated in the other bug for next_available_ip in the network, I am on my way to upgrade my infoblox devices and update you with my findings. But as per the code whats the max ip search range that can work ? Because with my ansible 2.5 it can go max upto 20. And the moment I am switching it to 21, its breaking though I have 100+ free IPs available in the subnet.

So I can think of two scenarios: a. If the search ip number is hard-coded in the code to 20, then we may have to remove it. b. If some one by mistake add the number let say 20 to search and only 10 free IPs available in the subnet, then it should return only 10 IPs as a result with some warning that "Only 10 free ips available in that subnet"

Else end to end automation cant be done and have to look from infoblox gui every time to see how many free IPs available and then have to map them one by one in the infoblox gui.

Udayendu commented 5 years ago

@yuewko @saiprasannasastry

In https://github.com/ansible/ansible/issues/60465 @JonasKs has mentioned that currently max search limit is set to 20 in infoblox-client. Can we extend that ? Because the for us, 20 wont work. Also check for the point[b] as mentioned in the above comment. Thats not handled well as of now and its throwing error once reached that point instead of showing the ips thats actually available out of requested search limit.

JonasKs commented 5 years ago

No, I did not say it's set to 20 in infoblox-client. I specifically said it's not:

This is a core Infoblox thing, not something that can be solved by the developers of Ansible or the python Infoblox-client module.

It's hardcoded to 20, but not in this python module. It's an Infoblox WAPI restriction. Try the same in the GUI, you'll see that you can at maximum request 20 next available IPs.

As for a work around that might work for you:

Udayendu commented 5 years ago

No, I did not say it's set to 20 in infoblox-client. I specifically said it's not:

This is a core Infoblox thing, not something that can be solved by the developers of Ansible or the python Infoblox-client module.

It's hardcoded to 20, but not in this python module. It's an Infoblox WAPI restriction. Try the same in the GUI, you'll see that you can at maximum request 20 next available IPs.

As for a work around that might work for you:

  • List all IPs in the subnet you want to reserve IPs from
  • Loop over the list, check if it's used or not
  • The ones that are not used are available.

Currently I am already doing the same through a python wrapper where passing the first and last free ip of a subnet to map it in the infoblox. But to get the free IPs every time I have to get into the infoblox GUI. We have more than 50 subnets per datacenters. Hence its not very convenient though working as a workaround. Hence I was looking for the search option.

It's an Infoblox WAPI restriction.

   How this infoblox WAPI can be fixed ?
saiprasannasastry commented 5 years ago

You will have to raise a NIOS support ticket and get it escalated from there

Udayendu commented 5 years ago

You will have to raise a NIOS support ticket and get it escalated from there

Sure. I will do that let you guys know. Hope to fix it soon.

JonasKs commented 5 years ago

Nice. Can you close this ticket, as it’s confirmed it has nothing to do with this codebase?

Udayendu commented 5 years ago

This bug can be closed now. It was due to the older version of infoblox. After upgrading the infoblox to 8.3.4 everything is working fine with ansible 2.8 and infoblox-client 0.4.22 .