-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UDMP - Running the default wlan example fails #55
Comments
I think the issue here is that your |
I should probably make sure the docs are clear about the path, I added some additional copy in 68386b3 that should be live with the next release. |
@paultyng awesome thanks, will retry shortly! |
I think I have the same issue and believe it is related to the UDM Pro having different API paths. There is a note about it here:
When I set the api_url to I'll see if I can get more detail but let me know what else I can provide, if needed. Really looking forward to using this, thanks for putting it together! |
Hmm, yes please let me know, I only have the normal UDM, not the Pro, so unable to test this locally. I've tested with the controller in docker as well (the acceptance testing on this repository uses that). |
Definitely something different compared to any examples I could find online (e.g. this page https://bartsimons.me/playing-around-with-the-ubiquiti-unifi-controller/), even just changing the api url's didnt help, so it might be a bigger issue. This command let's me auth: Then this lets me get the health and other endpoints follow this URL format: I'm afraid I'm not experienced with TF providers and can't really follow how it is calling anything, but happy to test anything out if you can point me in the right direction of where to adjust and then I could try to build it myself and test out. Thanks again. |
What version of the controller do you have running? I can at least try that exact version in tests via docker possibly. I'm asking someone at work if they can test with a UDM Pro as well, maybe get some additional info on this. |
I realised earlier that there is an open issue on your SDK repo about this: I don't know Go though, so I don't think I'll be able to do a PR for any changes, but your idea of splitting out the login and api path variables probably makes the most sense. I might have managed to make some hacky progress hard coding things in a new custom provider (never worked with custom providers or Go before, so all purely guesswork). Now I have the plans working again (including data sources actually reading fully, which were failing originally) but it is failing to apply changes and I'm just getting I have controller version 5.14.22. |
@paulhugill I think I have a PR up to fix this: #60 Assuming it passes the acc testing, I'll publishing a pre-release and you can give it a try. |
Thanks @paultyng it is using the correct endpoints now but not logging in, just gives a 401 error (debug attached). Putting
In fact, I've tried a few PUT and POST commands with Curl or Postman, and all I get is a 404 Not Found, even though doing a GET to those same endpoints returns results. Could I have missed a config setting to enable Writes with the API? I can't find anything and have been using the Owner or another SuperAdmin user for this. I appreciate your help with this and I know you don't have a UDMP to test with but any suggestions would be welcome. Thanks |
Maybe I need to ask Unifi to send me one on Twitter 😂 Someone on my team has a UDMP, I'll see if I can get her to try it out at some point. The other thing you can do, logging in to the UI in the browser (via IP, not WebRTC), and just look at the URLs in the debug tools for some of the pages (like networks, etc). Save a network, create one, delete, etc. and grab those URLs. |
I think you deserve one for all your effort putting this together (although I do understand there are some other problems with them!). I might have found the cause of the 404's, good suggestion to look at a working one done manually. Here is an example CURL that worked to great a FW Group (sanitized tokens obviously):
I don't know how that gets fed in but it does look like that header is also on the GET requests as well, so hopefully not a big deal to add. Guess they just don't care about that for Read-Only calls, which makes sense. |
I'm seeing the same 401 response with 0.15.0-beta.1 |
I was able to confirm that adding the |
I was able to add the CSRF pieces from that commit, into my fork and then get the apply to work properly with a custom built version of the provider, thanks @chrishas35. @paultyng would you like me to do a PR with the changes? I don't have any way to test it doesn't break the other controller versions, just that it seems to work on the UDMP. |
I've opened a PR against paultyng/go-unifi to add the two required headers for UDM Pro. |
Thanks! Will continue the discussion over in go-unifi. |
required for UnifiOS controllers (UDM, UDM Pro) Ref paultyng/terraform-provider-unifi#55
required for UnifiOS controllers (UDM, UDM Pro) Ref paultyng/terraform-provider-unifi#55
required for UnifiOS controllers (UDM, UDM Pro) Ref paultyng/terraform-provider-unifi#55
I added the CSRF support and just cut 0.15.0-beta.2 (should be live shortly): https://github.com/paultyng/terraform-provider-unifi/releases/tag/v0.15.0-beta.2 terraform {
required_providers {
unifi = {
source = "paultyng/unifi"
version = "0.15.0-beta.2"
}
}
} Let me know if this fixes it! |
@paultyng This seems to be working well for me now. @chrishas35 Thanks for sorting the CSRF piece. |
Great will close this and I can ship a real 0.15.0 soon. |
I'm getting failures with the following code, mostly taken from the samples:
Here is the output of version + apply:
FYI I'm running controller version 5.14.24 and Dream Machine Pro firmware 1.8.1-rc.3.
Thanks for writing this!
The text was updated successfully, but these errors were encountered: