OpenStack Compute Resource with prefix URI

Problem:
I am trying to set up an openstack compute resource in foreman. However, it seems it doesn’t like the URL I need to use. Our openstack installation has multiple controllers which are set behind a haproxy. So the URL I need to use access the tokens endpoint is https://cloud.example.com/identity/v3/auth/tokens

That URL works if I manually access the endpoint with curl. However, when I enter it as URL for a compute resource, it gets a 404. It seems even though I gave the full URL it still tries to access https://cloud.example.com/v3/auth/tokens instead which doesn’t work.

Looking at the source code here (not saying that it’s the right place to look) it seems that it only takes the host and port from the url and uses that a few lines later. So seeing that it would explain why it doesn’t work.

Expected outcome:
Accepting the full URL given, not only parts of it.

Foreman and Proxy versions:
3.0.1

Foreman and Proxy plugin versions:
Katello 4.2.2

Distribution and version:
CentOS 7.9

Hey @gvde - the docs kinda do check out with what you’ve experienced

In the URL field, enter the URL for the OpenStack Authentication keystone service’s API at the tokens resource. Use the following format: http://openstack.example.com:5000/v3.0/tokens.

https://docs.theforeman.org/3.1/Provisioning_Guide/index-foreman-el.html#adding-openstack-connection_openstack-provisioning

Well, I read docs usually more like examples unless they mention specifically, that it has to be a specific form. In particular, when docs are “broken” anyway, because the identity endpoint is actually /v3/auth/tokens according to the openstack docs

Neither using ‘/v3.0/’ nor omitting ‘/auth/’ is working on our openstack installation.

So I wouldn’t consider the current foreman provisioning guide a real reference to decide whether a URI prefix would/should work or not.

1 Like

Any insight? Docs are incorrect and the code doesn’t seem to handle prefix URIs. Where do I open issues for the docs and where for the openstack interface?

I belive this was added in Fixes #34346 - support Openstack URI with paths by ares · Pull Request #9069 · theforeman/foreman · GitHub so the current code seems to handle it, but it will only be delivered in Foreman 3.3

You might apply manually and let us know if that helped, but official path would be to install nightlies or wait for Foreman 3.3 to GA.

1 Like

Thanks. I have edited openstack.rb and I am able to get a connection. Now I have to find the best way to configure it…