I've pushed some changes and fixes to trunk and in trunk you can now use
Swift diver as follows:

https://gist.github.com/Kami/8ec3d7349bdc7d516fc6

I've tested it with Swift All In One installation and everything appears to
be working fine (it would be great if others can confirm this as well).

Shortly, I will also be updating the documentation and add some information
on how to use the Swift driver there as well.


On Tue, May 20, 2014 at 5:22 PM, Shade Alabsa <[email protected]> wrote:

> So I didn't change the URL for the SAIO install but it still doesn't work
> though I do get a slightly different error this time around. Using this for
> driver_os
>
> driver_os = cls_os('test:tester', 'testing',
>                     ex_force_auth_url='http://172.16.99.131:8080',
>                     ex_force_auth_version='1.0')
>
> I get this error,
>
> Traceback (most recent call last):
>   File "/data/python_scripts/pyCloud.py", line 88, in <module>
>     driver_os.create_container("python")
>   File
> "/usr/lib/python2.7/site-packages/libcloud/storage/drivers/cloudfiles.py",
> line 325, in create_container
>     '/%s' % (container_name_encoded), method='PUT')
>   File
> "/usr/lib/python2.7/site-packages/libcloud/storage/drivers/cloudfiles.py",
> line 181, in request
>     raw=raw)
>   File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> line 575, in request
>     return super(OpenStackBaseConnection, self).request(**kwargs)
>   File "/usr/lib/python2.7/site-packages/libcloud/common/base.py", line
> 596, in request
>     action = self.morph_action_hook(action)
>   File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> line 571, in morph_action_hook
>     self._populate_hosts_and_request_paths()
>   File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> line 600, in _populate_hosts_and_request_paths
>     osa.authenticate()  # may throw InvalidCreds
>   File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> line 155, in authenticate
>     return self.authenticate_2_0_with_apikey()
>   File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> line 240, in authenticate_2_0_with_apikey
>     return self.authenticate_2_0_with_body(reqbody)
>   File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> line 259, in authenticate_2_0_with_body
>     raise InvalidCredsError()
> libcloud.common.types.InvalidCredsError: 'Invalid credentials with the
> provider'
>
>
> Here is also the debug log
>
> # -------- begin 15530608 request ----------
> curl -i -X POST -H 'Content-Length: 91' -H 'Accept-Encoding: gzip,deflate'
> -H 'X-LC-Request-ID: 15530608' -H 'Accept: application/json' -H
> 'User-Agent: libcloud/0.14.1 ' -H 'Host: 172.16.99.131:8080' -H
> 'Content-Type: application/json; charset=UTF-8' --data-binary '{"auth":
> {"RAX-KSKEY:apiKeyCredentials": {"username": "test:tester", "apiKey":
> "testing"}}}' --compress http://172.16.99.131:8080/v2.0/tokens
> # -------- begin 15530608:15966648 response ----------
> HTTP/1.1 401 Unauthorized^M
> Date: Tue, 20 May 2014 15:14:53 GMT^M
> Content-Length: 131^M
> Content-Type: text/html; charset=UTF-8^M
> Www-Authenticate: Swift realm="tokens"^M
> X-Trans-Id: tx1d91d51704fe446aabba4-00537b716d^M
> ^M
> <html><h1>Unauthorized</h1><p>This server could not verify that you are
> authorized to access the document you requested.</p></html>
> # -------- end 15530608:15966648 response ----------
>
> It is interesting that it is trying to use v1.0 though I specify v1.0. If I
> do a full URL though I do get a different error, similar to the initial one
> I sent an email for. The output for that is below.
>
> Driver: I tried with ex_force_auth_version and without including that at
> all and got the same thing for both.
>
> driver_os = cls_os('test:tester', 'testing',
>                     ex_force_auth_url='http://172.16.99.131:8080/auth/v1.0
> ',
>                     ex_force_auth_version='1.0')
>
> Error Output:
>
> Traceback (most recent call last):
>   File "/data/python_scripts/pyCloud.py", line 88, in <module>
>     driver_os.create_container("python")
>   File
> "/usr/lib/python2.7/site-packages/libcloud/storage/drivers/cloudfiles.py",
> line 325, in create_container
>     '/%s' % (container_name_encoded), method='PUT')
>   File
> "/usr/lib/python2.7/site-packages/libcloud/storage/drivers/cloudfiles.py",
> line 181, in request
>     raw=raw)
>   File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> line 575, in request
>     return super(OpenStackBaseConnection, self).request(**kwargs)
>   File "/usr/lib/python2.7/site-packages/libcloud/common/base.py", line
> 596, in request
>     action = self.morph_action_hook(action)
>   File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> line 571, in morph_action_hook
>     self._populate_hosts_and_request_paths()
>   File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> line 600, in _populate_hosts_and_request_paths
>     osa.authenticate()  # may throw InvalidCreds
>   File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> line 155, in authenticate
>     return self.authenticate_2_0_with_apikey()
>   File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> line 240, in authenticate_2_0_with_apikey
>     return self.authenticate_2_0_with_body(reqbody)
>   File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> line 264, in authenticate_2_0_with_body
>     driver=self.driver)
> libcloud.common.types.MalformedResponseError: <MalformedResponseException
> in None 'Malformed response'>: 'code: 400 body: <html><h1>Bad
> Request</h1><p>The server could not comply with the request since it is
> either malformed or otherwise incorrect.</p></html>'
>
> Debug log output:
>
> # -------- begin 40356536 request ----------
> curl -i -X POST -H 'Content-Length: 91' -H 'Accept-Encoding: gzip,deflate'
> -H 'X-LC-Request-ID: 40356536' -H 'Accept: application/json' -H
> 'User-Agent: libcloud/0.14.1 ' -H 'Host: 172.16.99.131:8080' -H
> 'Content-Type: application/json; charset=UTF-8' --data-binary '{"auth":
> {"RAX-KSKEY:apiKeyCredentials": {"username": "test:tester", "apiKey":
> "testing"}}}' --compress http://172.16.99.131:8080/auth/v1.0
> # -------- begin 40356536:40792576 response ----------
> HTTP/1.1 400 Bad Request^M
> Date: Tue, 20 May 2014 15:18:25 GMT^M
> Content-Length: 137^M
> Content-Type: text/html; charset=UTF-8^M
> X-Trans-Id: tx8506073204a04363bbe33-00537b7241^M
> ^M
> <html><h1>Bad Request</h1><p>The server could not comply with the request
> since it is either malformed or otherwise incorrect.</p></html>
> # -------- end 40356536:40792576 response ----------
>
>
> Now the curl commands I use are below so you can see if maybe I'm supplying
> something wrong.
>
> curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing'
> http://172.16.99.131:8080/auth/v1.0
>
> curl -v -H 'X-Auth-Token: AUTH_tk536581d9cc404e4bb7e7c41dca17f9b5'
> http://172.16.99.131:8080/v1/AUTH_test
>
> Hopefully we can get this solved. Thanks!
>
> Shade
>
>
>
> On Tue, May 20, 2014 at 11:01 AM, Shade Alabsa <[email protected]>
> wrote:
>
> > Markos,
> >    Thanks for the quick reply! I actually have tried that. I've used
> both,
> >                     ex_force_auth_url='http://172.16.103.90:35357' and
> > ex_force_auth_url='http://172.16.103.90:35357/auth/v2.0/tokens
> >
> > Both generate the same error for me.
> >
> > Shade
> >
> >
> >
> > On Tue, May 20, 2014 at 10:47 AM, Markos Gogoulos <[email protected]
> >wrote:
> >
> >>
> >>
> >> Hi Shade,
> >>
> >> check the examples on
> >>
> http://libcloud.readthedocs.org/en/latest/compute/drivers/openstack.html,
> >> you might need to strip "/v2.0" on OS_AUTH_URL or include the full URL
> >>
> >>
> >> export OS_AUTH_URL=http://172.16.103.90:35357
> >>
> >> or
> >>
> >> export
> >> OS_AUTH_URL=http://172.16.103.90:35357/v2.0/tokens
> >>
> >> cheers
> >>
> >> Στις
> >> 20.05.2014 16:51, Shade Alabsa έγραψε:
> >>
> >> > Hey,
> >> > I am trying to use
> >> libcloud to work with various cloud providers object
> >> > storage backend.
> >> I have been successfully able to get it working with
> >> > Amazon but I've
> >> installed two different installations of openstack and it
> >> > does not
> >> appear to work. My first installation I followed the SAIO guide,
> >> >
> >> http://docs.openstack.org/developer/swift/development_saio.html [1]
> this
> >> one to
> >> > be exact. I am successfully able to connect to it, list,
> >> upload, and
> >> > download objects from another computer using curl and the
> >> swift client.
> >> > Whenever I try and connect via libcloud though I get a
> >> malformed error
> >> > response. This instance uses version 1 of the
> >> authentication. I set up
> >> > another installation but this time a full
> >> installation, following the
> >> > openstack documenations, on three servers
> >> using keystone for
> >> > authentication. Again I am able to successfully
> >> connect using curl and
> >> > swift client but libcloud I am not. It's quite
> >> possible I am doing
> >> > something wrong and I've asked in the IRC channel
> >> quite a bit over the past
> >> > week but that channel seems to be quite
> >> dead. I did find that another user
> >> > is having this problem and he filed
> >> a bug but so far nobody has done
> >> > anything to fix it. The bug is
> >> located here,
> >> > https://issues.apache.org/jira/browse/LIBCLOUD-542 [2]
> >> .
> >> >
> >> > So when I run my test script this is the error I'm getting,
> >> >
> >> >
> >> [root@bruenor python_scripts]# python pyCloud.py
> >> > Traceback (most
> >> recent call last):
> >> > File "pyCloud.py", line 84, in <module>
> >> >
> >> driver_os.create_container("python")
> >> > File
> >> >
> >>
> "/usr/lib/python2.7/site-packages/libcloud/storage/drivers/cloudfiles.py",
> >> >
> >> line 325, in create_container
> >> > '/%s' % (container_name_encoded),
> >> method='PUT')
> >> > File
> >> >
> >>
> "/usr/lib/python2.7/site-packages/libcloud/storage/drivers/cloudfiles.py",
> >> >
> >> line 181, in request
> >> > raw=raw)
> >> > File
> >> "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> >> > line
> >> 575, in request
> >> > return super(OpenStackBaseConnection,
> >> self).request(**kwargs)
> >> > File
> >> "/usr/lib/python2.7/site-packages/libcloud/common/base.py", line
> >> > 596,
> >> in request
> >> > action = self.morph_action_hook(action)
> >> > File
> >> "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> >> > line
> >> 571, in morph_action_hook
> >> > self._populate_hosts_and_request_paths()
> >> >
> >> File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> >> >
> >> line 600, in _populate_hosts_and_request_paths
> >> > osa.authenticate() #
> >> may throw InvalidCreds
> >> > File
> >> "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> >> > line
> >> 155, in authenticate
> >> > return self.authenticate_2_0_with_apikey()
> >> > File
> >> "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> >> > line
> >> 240, in authenticate_2_0_with_apikey
> >> > return
> >> self.authenticate_2_0_with_body(reqbody)
> >> > File
> >> "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py",
> >> > line
> >> 264, in authenticate_2_0_with_body
> >> > driver=self.driver)
> >> >
> >> libcloud.common.types.MalformedResponseError:
> >> <MalformedResponseException
> >> > in None 'Malformed response'>: 'code: 400
> >> body: {"error": {"message":
> >> > "Expecting to find passwordCredentials in
> >> auth. The server could not comply
> >> > with the request since it is either
> >> malformed or otherwise incorrect. The
> >> > client is assumed to be in
> >> error.", "code": 400, "title": "Bad Request"}}'
> >> >
> >> > Now when I connect
> >> to this instance using the swift client I source this
> >> > file for
> >> authentication,
> >> >
> >> > export OS_USERNAME=admin
> >> > export
> >> OS_PASSWORD=password
> >> > export OS_TENANT_NAME=admin
> >> > export
> >> OS_AUTH_URL=http://172.16.103.90:35357/v2.0 [3]
> >> >
> >> > I have also set
> >> LIBCLOUD_DEBUG in my bashrc and here is the output for that
> >> > for my
> >> request
> >> >
> >> > # -------- begin 38136000 request ----------
> >> > curl -i -X
> >> POST -H 'Content-Length: 92' -H 'Accept-Encoding: gzip,deflate'
> >> > -H
> >> 'X-LC-Request-ID: 38136000' -H 'Accept: application/json' -H
> >> >
> >> 'User-Agent: libcloud/0.14.1 ' -H 'Host: 172.16.103.90:35357' -H
> >> >
> >> 'Content-Type: application/json; charset=UTF-8' --data-binary
> >> '{"auth":
> >> > {"RAX-KSKEY:apiKeyCredentials": {"username": "admin:admin",
> >> "apiKey":
> >> > "password"}}}' --compress http://172.16.103.90:35357/v2.0
> >> [3]
> >> > # -------- begin 38136000:38547400 response ----------
> >> > HTTP/1.1
> >> 400 Bad Request
> >> > Date: Tue, 20 May 2014 13:28:52 GMT
> >> > Content-Type:
> >> application/json
> >> > Content-Length: 121
> >> > Vary: X-Auth-Token
> >> >
> >> X-Distribution: Ubuntu
> >> >
> >> > {"error": {"message": "get_version_v2() got
> >> an unexpected keyword argument
> >> > 'auth'", "code": 400, "title": "Bad
> >> Request"}}
> >> > # -------- end 38136000:38547400 response ----------
> >> >
> >> > #
> >> -------- begin 18843768 request ----------
> >> > curl -i -X POST -H
> >> 'Content-Length: 92' -H 'Accept-Encoding: gzip,deflate'
> >> > -H
> >> 'X-LC-Request-ID: 18843768' -H 'Accept: application/json' -H
> >> >
> >> 'User-Agent: libcloud/0.14.1 ' -H 'Host: 172.16.103.90:5000' -H
> >> >
> >> 'Content-Type: application/json; charset=UTF-8' --data-binary
> >> '{"auth":
> >> > {"RAX-KSKEY:apiKeyCredentials": {"username": "admin:admin",
> >> "apiKey":
> >> > "password"}}}' --compress
> >> http://172.16.103.90:5000/v2.0/tokens [4]
> >> > # -------- begin
> >> 18843768:19255168 response ----------
> >> > HTTP/1.1 400 Bad Request
> >> > Date:
> >> Tue, 20 May 2014 13:29:09 GMT
> >> > Content-Type: application/json
> >> >
> >> Content-Length: 245
> >> > Vary: X-Auth-Token
> >> > X-Distribution: Ubuntu
> >> >
> >> >
> >> {"error": {"message": "Expecting to find passwordCredentials in auth.
> >> The
> >> > server could not comply with the request since it is either
> >> malformed or
> >> > otherwise incorrect. The client is assumed to be in
> >> error.", "code": 400,
> >> > "title": "Bad Request"}}
> >> > # -------- end
> >> 18843768:19255168 response ----------
> >> >
> >> > Also here is the script I'm
> >> using to connect, create a container, and list
> >> > the containers to check
> >> to see if I'm doing something wrong.
> >> >
> >> >
> >> http://paste.fedoraproject.org/103410/59383214 [5]
> >> >
> >> > Thanks for the
> >> help!
> >> >
> >> > Shade
> >>
> >>
> >>
> >> Links:
> >> ------
> >> [1]
> >> http://docs.openstack.org/developer/swift/development_saio.html
> >> [2]
> >> https://issues.apache.org/jira/browse/LIBCLOUD-542
> >> [3]
> >> http://172.16.103.90:35357/v2.0
> >> [4]
> >> http://172.16.103.90:5000/v2.0/tokens
> >> [5]
> >> http://paste.fedoraproject.org/103410/59383214
> >>
> >
> >
>

Reply via email to