[
https://issues.apache.org/jira/browse/LIBCLOUD-972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Abraham Cabrera updated LIBCLOUD-972:
-------------------------------------
Description:
Trying to connect to Softlayer COS(Cloud object Storage) using apache libcloud
and I can't get it to work. Code below with original stackoverflow question
[https://stackoverflow.com/questions/48068896/connecting-to-softlayer-object-storage-using-apache-libcloud].
{code:python}
from pprint import pprint
from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver
_authurl = "https://lon02.objectstorage.softlayer.net/auth/v1.0"
_user = "IBMOS<redacted>"
_key = "<redacted>"
_swift = get_driver(Provider.OPENSTACK_SWIFT)
driver = _swift(_user, _key,
ex_force_auth_url=_authurl,
ex_force_auth_version='1.0',
ex_force_service_type='object-store',
ex_force_service_name=None)
pprint(driver.list_containers())
Traceback (most recent call last):
File "swift.py", line 17, in <module>
pprint(driver.list_containers())
File "/usr/local/lib/python3.6/site-packages/libcloud/storage/base.py", line
209, in list_containers
return list(self.iterate_containers())
File
"/usr/local/lib/python3.6/site-packages/libcloud/storage/drivers/cloudfiles.py",
line 275, in iterate_containers
response = self.connection.request('')
File
"/usr/local/lib/python3.6/site-packages/libcloud/storage/drivers/cloudfiles.py",
line 165, in request
raw=raw)
File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack.py",
line 223, in request
raw=raw)
File "/usr/local/lib/python3.6/site-packages/libcloud/common/base.py", line
536, in request
action = self.morph_action_hook(action)
File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack.py",
line 290, in morph_action_hook
self._populate_hosts_and_request_paths()
File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack.py",
line 335, in _populate_hosts_and_request_paths
url = self._ex_force_base_url or self.get_endpoint()
File
"/usr/local/lib/python3.6/site-packages/libcloud/storage/drivers/cloudfiles.py",
line 139, in get_endpoint
name=self._service_name, region=self._service_region)
File
"/usr/local/lib/python3.6/site-packages/libcloud/common/openstack_identity.py",
line 291, in get_endpoint
raise LibcloudError('Could not find specified endpoint')
libcloud.common.types.LibcloudError: <LibcloudError in None 'Could not find
specified endpoint'>
{code}
open debugging
/usr/local/lib/python3.6/site-packages/libcloud/common/openstack_identity.py I
noticed that the list entires(OpenStackServiceCatalogEntry) we iterate over do
not have all the members set and this causes us to eventually not get an
endpoint.
{code:python}
[<OpenStackServiceCatalogEntry service_type=cloudServers, service_name=None,
endpoints=[],
<OpenStackServiceCatalogEntry service_type=cloudFilesCDN, service_name=None,
endpoints=[],
<OpenStackServiceCatalogEntry service_type=cloudFiles, service_name=None,
endpoints=[<OpenStackServiceCatalogEntryEndpoint region=None,
url=https://lon02.objectstorage.softlayer.net/v1/AUTH_651502c4-f26f-4b6b-9300-32622fd6528c,
type=external]]
{code}
I was able to circumvent this by adding in another check specifically
https://github.com/apache/libcloud/blob/trunk/libcloud/common/openstack_identity.py#L270
{code:python}
if name and entry.service_name and entry.service_name != name:
print("continue2")
continue
{code}
apologies if this is not the right format or confusing. I can certainly provide
more details/information on request at acabrer[at]us[dot]ibm[dot]com or
cab[dot]abraham[at]gmail[dot]com
was:
Trying to connect to Softlayer COS(Cloud object Storage) using apache libcloud
and I can't get it to work. Code below with original stackoverflow question
[https://stackoverflow.com/questions/48068896/connecting-to-softlayer-object-storage-using-apache-libcloud].
{code:python}
from pprint import pprint
from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver
_authurl = "https://lon02.objectstorage.softlayer.net/auth/v1.0"
_user = "IBMOS<redacted>"
_key = "<redacted>"
_swift = get_driver(Provider.OPENSTACK_SWIFT)
driver = _swift(_user, _key,
ex_force_auth_url=_authurl,
ex_force_auth_version='1.0',
ex_force_service_type='object-store',
ex_force_service_name=None)
pprint(driver.list_containers())
Traceback (most recent call last):
File "swift.py", line 17, in <module>
pprint(driver.list_containers())
File "/usr/local/lib/python3.6/site-packages/libcloud/storage/base.py", line
209, in list_containers
return list(self.iterate_containers())
File
"/usr/local/lib/python3.6/site-packages/libcloud/storage/drivers/cloudfiles.py",
line 275, in iterate_containers
response = self.connection.request('')
File
"/usr/local/lib/python3.6/site-packages/libcloud/storage/drivers/cloudfiles.py",
line 165, in request
raw=raw)
File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack.py",
line 223, in request
raw=raw)
File "/usr/local/lib/python3.6/site-packages/libcloud/common/base.py", line
536, in request
action = self.morph_action_hook(action)
File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack.py",
line 290, in morph_action_hook
self._populate_hosts_and_request_paths()
File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack.py",
line 335, in _populate_hosts_and_request_paths
url = self._ex_force_base_url or self.get_endpoint()
File
"/usr/local/lib/python3.6/site-packages/libcloud/storage/drivers/cloudfiles.py",
line 139, in get_endpoint
name=self._service_name, region=self._service_region)
File
"/usr/local/lib/python3.6/site-packages/libcloud/common/openstack_identity.py",
line 291, in get_endpoint
raise LibcloudError('Could not find specified endpoint')
libcloud.common.types.LibcloudError: <LibcloudError in None 'Could not find
specified endpoint'>
{code}
open inspecting
/usr/local/lib/python3.6/site-packages/libcloud/common/openstack_identity.py I
noticed that the list entires(OpenStackServiceCatalogEntry) we iterate over do
not have all the members set and so this causes us to eventually not get an
endpoint. I was able to circumvent this by adding in another check specifically
https://github.com/apache/libcloud/blob/trunk/libcloud/common/openstack_identity.py#L270
{code:python}
if name and entry.service_name and entry.service_name != name:
print("continue2")
continue
{code}
apologies if this is not the right format or confusing. I can certainly provide
more details/information on request at acabrer[at]us[dot]ibm[dot]com or
cab[dot]abraham[at]gmail[dot]com
> Connecting to softlayer object storage raises None type exception
> -----------------------------------------------------------------
>
> Key: LIBCLOUD-972
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-972
> Project: Libcloud
> Issue Type: Bug
> Components: Storage
> Environment: mac os High Sierra 10.13.2
> python3.6
> apache-libcloud==2.2.1
> Reporter: Abraham Cabrera
>
> Trying to connect to Softlayer COS(Cloud object Storage) using apache
> libcloud and I can't get it to work. Code below with original stackoverflow
> question
> [https://stackoverflow.com/questions/48068896/connecting-to-softlayer-object-storage-using-apache-libcloud].
> {code:python}
> from pprint import pprint
> from libcloud.storage.types import Provider
> from libcloud.storage.providers import get_driver
> _authurl = "https://lon02.objectstorage.softlayer.net/auth/v1.0"
> _user = "IBMOS<redacted>"
> _key = "<redacted>"
> _swift = get_driver(Provider.OPENSTACK_SWIFT)
> driver = _swift(_user, _key,
> ex_force_auth_url=_authurl,
> ex_force_auth_version='1.0',
> ex_force_service_type='object-store',
> ex_force_service_name=None)
> pprint(driver.list_containers())
> Traceback (most recent call last):
> File "swift.py", line 17, in <module>
> pprint(driver.list_containers())
> File "/usr/local/lib/python3.6/site-packages/libcloud/storage/base.py",
> line 209, in list_containers
> return list(self.iterate_containers())
> File
> "/usr/local/lib/python3.6/site-packages/libcloud/storage/drivers/cloudfiles.py",
> line 275, in iterate_containers
> response = self.connection.request('')
> File
> "/usr/local/lib/python3.6/site-packages/libcloud/storage/drivers/cloudfiles.py",
> line 165, in request
> raw=raw)
> File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack.py",
> line 223, in request
> raw=raw)
> File "/usr/local/lib/python3.6/site-packages/libcloud/common/base.py", line
> 536, in request
> action = self.morph_action_hook(action)
> File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack.py",
> line 290, in morph_action_hook
> self._populate_hosts_and_request_paths()
> File "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack.py",
> line 335, in _populate_hosts_and_request_paths
> url = self._ex_force_base_url or self.get_endpoint()
> File
> "/usr/local/lib/python3.6/site-packages/libcloud/storage/drivers/cloudfiles.py",
> line 139, in get_endpoint
> name=self._service_name, region=self._service_region)
> File
> "/usr/local/lib/python3.6/site-packages/libcloud/common/openstack_identity.py",
> line 291, in get_endpoint
> raise LibcloudError('Could not find specified endpoint')
> libcloud.common.types.LibcloudError: <LibcloudError in None 'Could not find
> specified endpoint'>
> {code}
> open debugging
> /usr/local/lib/python3.6/site-packages/libcloud/common/openstack_identity.py
> I noticed that the list entires(OpenStackServiceCatalogEntry) we iterate over
> do not have all the members set and this causes us to eventually not get an
> endpoint.
> {code:python}
> [<OpenStackServiceCatalogEntry service_type=cloudServers, service_name=None,
> endpoints=[],
> <OpenStackServiceCatalogEntry service_type=cloudFilesCDN, service_name=None,
> endpoints=[],
> <OpenStackServiceCatalogEntry service_type=cloudFiles, service_name=None,
> endpoints=[<OpenStackServiceCatalogEntryEndpoint region=None,
> url=https://lon02.objectstorage.softlayer.net/v1/AUTH_651502c4-f26f-4b6b-9300-32622fd6528c,
> type=external]]
> {code}
> I was able to circumvent this by adding in another check specifically
> https://github.com/apache/libcloud/blob/trunk/libcloud/common/openstack_identity.py#L270
> {code:python}
> if name and entry.service_name and entry.service_name != name:
> print("continue2")
> continue
> {code}
> apologies if this is not the right format or confusing. I can certainly
> provide more details/information on request at acabrer[at]us[dot]ibm[dot]com
> or cab[dot]abraham[at]gmail[dot]com
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)