Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

openstacksdk: NotFoundException:

Attempting to use the openstacksdk python APIs to list servers, and getting a 404 Not Found.

Here is my code:

```
from openstack import connection
from openstack import profile

self.profile = profile.Profile()
self.profile.set_region(self.profile.ALL, "reg1")
self.profile.set_version('identity', 3)

self.osconnection = connection.Connection(
profile=self.profile,
auth_url="https://keystone.reg1.abc.net:443/v3",
project_name="admin",
username="behzad",
password="mypass",
project_domain_name="default",
user_domain_name="Default",
tenant_name="admin")

for server in self.osconnection.compute.servers():
print "server: ", server

Exception :

ERROR: test_basic (osshell_ut.OSShellUt)

Traceback (most recent call last): File "osshell_ut.py", line 12, in test_basic res = resource.OSResource() File "/Users/behzad_dastur/CODE/osshellaug22/os-shell/osshell/resource.py", line 63, in __init__ for server in self.osconnection.compute.servers(): File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/openstack/resource2.py", line 709, in list params=query_params) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/keystoneauth1/session.py", line 668, in get retval = self.request(url, 'GET', *kwargs) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/openstack/session.py", line 39, in map_exceptions_wrapper return func(args, *kwargs) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/openstack/session.py", line 248, in request return super(Session, self).request(args, *kwargs) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/positional/__init__.py", line 101, in inner return wrapped(args, *kwargs) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/keystoneauth1/session.py", line 484, in request *endpoint_filter) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/openstack/session.py", line 237, in get_endpoint sc_endpoint) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/openstack/session.py", line 123, in _get_endpoint_versions response = self.get(root_endpoint) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/keystoneauth1/session.py", line 668, in get retval = self.request(url, 'GET', **kwargs) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/openstack/session.py", line 46, in map_exceptions_wrapper http_status=e.http_status, cause=e) NotFoundException: NotFoundException: Not Found, <html> <head> <title>404 Not Found</title> </head> <body>

404 Not Found

The resource could not be found.

</body> </html>

``` Not clear what am I missing. I can use the openstack CLI and get the server list successfully with the same rc credentials.

openstacksdk: NotFoundException:

Attempting to use the openstacksdk python APIs to list servers, and getting a 404 Not Found.

Here is my code:

```
from openstack import connection
from openstack import profile

self.profile = profile.Profile()
self.profile.set_region(self.profile.ALL, "reg1")
self.profile.set_version('identity', 3)

self.osconnection = connection.Connection(
profile=self.profile,
auth_url="https://keystone.reg1.abc.net:443/v3",
project_name="admin",
username="behzad",
password="mypass",
project_domain_name="default",
user_domain_name="Default",
tenant_name="admin")

for server in self.osconnection.compute.servers():
print "server: ", server

Exception :

```

ERROR: test_basic (osshell_ut.OSShellUt)

(osshell_ut.OSShellUt) ---------------------------------------------------------------------- Traceback (most recent call last): File "osshell_ut.py", line 12, in test_basic res = resource.OSResource() File "/Users/behzad_dastur/CODE/osshellaug22/os-shell/osshell/resource.py", line 63, in __init__ for server in self.osconnection.compute.servers(): File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/openstack/resource2.py", line 709, in list params=query_params) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/keystoneauth1/session.py", line 668, in get retval = self.request(url, 'GET', *kwargs) **kwargs) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/openstack/session.py", line 39, in map_exceptions_wrapper return func(args, *kwargs) func(*args, **kwargs) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/openstack/session.py", line 248, in request return super(Session, self).request(args, *kwargs) self).request(*args, **kwargs) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/positional/__init__.py", line 101, in inner return wrapped(args, *kwargs) wrapped(*args, **kwargs) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/keystoneauth1/session.py", line 484, in request *endpoint_filter) **endpoint_filter) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/openstack/session.py", line 237, in get_endpoint sc_endpoint) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/openstack/session.py", line 123, in _get_endpoint_versions response = self.get(root_endpoint) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/keystoneauth1/session.py", line 668, in get retval = self.request(url, 'GET', **kwargs) File "/Users/behzad_dastur/pyenvironments/osenv1/lib/python2.7/site-packages/openstack/session.py", line 46, in map_exceptions_wrapper http_status=e.http_status, cause=e) NotFoundException: NotFoundException: Not Found, <html> <head> <title>404 Not Found</title> </head> <body>

404 <h1>404 Not Found

Found</h1> The resource could not be found.

found.<br /><br /> </body> </html>

</html>

```

Not clear what am I missing. I can use the openstack CLI and get the server list successfully with the same rc credentials.