Openstack cloud boto get_all_bucket()返回未找到的元素

2024-06-06 00:24:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试将Boto(2.38版)S3连接到我的Openstack(Juno)云并列出容器(bucket)。在

Python2.7和swift3中间件(https://github.com/stackforge/swift3)就是这样。在

我使用的是管理员帐户,这也是我创建他们的帐户,所以这不应该是一个权限问题。在

我可以建立一个ec2连接并列出所有的图像。在

我也拿不到一个单独的水桶。尝试检索的对象中有1个对象,我可以在Openstack仪表板中看到它,还可以与python swiftclient一起列出。在

如有任何建议,我们将不胜感激!在

import boto
import boto.s3.connection
from boto.s3.connection import OrdinaryCallingFormat

import logging
logging.basicConfig(filename="boto.log", level=logging.DEBUG)

A_KEY = '<access_key>'
S_KEY = '<secret_key>'

s3_conn = boto.connect_s3(
    aws_access_key_id=A_KEY,
    aws_secret_access_key=S_KEY,
    port=8080,
    host='<host>',
    is_secure=False,
    path='/swift/v1',
    validate_certs=False,
    calling_format=boto.s3.connection.OrdinaryCallingFormat())

s3_conn.get_all_buckets()

###############################################

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/macleanal/Development/cl2/lib/python2.7/site-packages/boto/s3/connection.py", line 445, in get_all_buckets
    xml.sax.parseString(body, h)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/__init__.py", line 49, in parseString
    parser.parse(inpsrc)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/expatreader.py", line 110, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/xmlreader.py", line 125, in parse
    self.close()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/expatreader.py", line 225, in close
    self.feed("", isFinal = 1)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/expatreader.py", line 217, in feed
    self._err_handler.fatalError(exc)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/sax/handler.py", line 38, in fatalError
raise exception
xml.sax._exceptions.SAXParseException: <unknown>:1:0: no element found

#################################################

b = s3_conn.get_bucket('Test')

#################################################

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/macleanal/Development/cl2/lib/python2.7/site-packages/boto/s3/connection.py", line 502, in get_bucket
    return self.head_bucket(bucket_name, headers=headers)
  File "/Users/macleanal/Development/cl2/lib/python2.7/site-packages/boto/s3/connection.py", line 549, in head_bucket
    response.status, response.reason, body)
boto.exception.S3ResponseError: S3ResponseError: 204 No Content

还有日志:

^{pr2}$

Tags: inpys3bucketliblinelibraryframework