public
Created

s3cmd 0.9.9.91 patch for eucalyptus

  • Download Gist
gistfile1.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
diff -cr -r /usr/share/s3cmd/S3/ACL.py ./S3/ACL.py
*** /usr/share/s3cmd/S3/ACL.py 2009-01-07 04:16:32.000000000 -0800
--- ./S3/ACL.py 2011-02-24 17:57:20.583095822 -0800
***************
*** 31,37 ****
return self.tag == "URI" and self.name == Grantee.ALL_USERS_URI
def isAnonRead(self):
! return self.isAllUsers and self.permission == "READ"
def getElement(self):
el = ET.Element("Grant")
--- 31,37 ----
return self.tag == "URI" and self.name == Grantee.ALL_USERS_URI
def isAnonRead(self):
! return self.isAllUsers() and self.permission == "READ"
def getElement(self):
el = ET.Element("Grant")
Binary files /usr/share/s3cmd/S3/ACL.pyc and ./S3/ACL.pyc differ
diff -cr -r /usr/share/s3cmd/S3/Config.py ./S3/Config.py
*** /usr/share/s3cmd/S3/Config.py 2009-06-02 03:18:12.000000000 -0700
--- ./S3/Config.py 2011-02-24 17:57:20.773073905 -0800
***************
*** 17,22 ****
--- 17,23 ----
secret_key = ""
host_base = "s3.amazonaws.com"
host_bucket = "%(bucket)s.s3.amazonaws.com"
+ service_path = ""
simpledb_host = "sdb.amazonaws.com"
cloudfront_host = "cloudfront.amazonaws.com"
cloudfront_resource = "/2008-06-30/distribution"
Binary files /usr/share/s3cmd/S3/Config.pyc and ./S3/Config.pyc differ
diff -cr -r /usr/share/s3cmd/S3/S3.py ./S3/S3.py
*** /usr/share/s3cmd/S3/S3.py 2009-10-07 14:40:21.000000000 -0700
--- ./S3/S3.py 2011-02-24 17:57:20.573068694 -0800
***************
*** 63,70 ****
for header in self.headers.keys():
if header.startswith("x-amz-"):
h += header+":"+str(self.headers[header])+"\n"
! if self.resource['bucket']:
! h += "/" + self.resource['bucket']
h += self.resource['uri']
debug("SignHeaders: " + repr(h))
signature = sign_string(h)
--- 63,71 ----
for header in self.headers.keys():
if header.startswith("x-amz-"):
h += header+":"+str(self.headers[header])+"\n"
! # if self.resource['bucket']:
! # h += "/" + self.resource['bucket']
!
h += self.resource['uri']
debug("SignHeaders: " + repr(h))
signature = sign_string(h)
***************
*** 385,396 ****
object = uri.has_object() and uri.object() or None
if bucket:
! resource['bucket'] = str(bucket)
if object:
! resource['uri'] = "/" + self.urlencode_string(object)
if extra:
resource['uri'] += extra
method_string = S3.http_methods.getkey(S3.operations[operation] & S3.http_methods["MASK"])
request = S3Request(self, method_string, resource, headers, params)
--- 386,404 ----
object = uri.has_object() and uri.object() or None
if bucket:
! # resource['bucket'] = str(bucket)
! resource['uri'] = "/" + self.urlencode_string(bucket)
if object:
! # resource['uri'] = "/" + self.urlencode_string(object)
! resource['uri'] = resource['uri'] + "/" + self.urlencode_string(object)
!
if extra:
resource['uri'] += extra
+ # hopefully this is the right place
+ if self.config.service_path:
+ resource['uri'] = self.config.service_path + resource['uri']
+
method_string = S3.http_methods.getkey(S3.operations[operation] & S3.http_methods["MASK"])
request = S3Request(self, method_string, resource, headers, params)
Binary files /usr/share/s3cmd/S3/S3.pyc and ./S3/S3.pyc differ
diff -cr -r /usr/share/s3cmd/S3/Utils.py ./S3/Utils.py
*** /usr/share/s3cmd/S3/Utils.py 2009-06-02 04:01:36.000000000 -0700
--- ./S3/Utils.py 2011-02-24 17:57:20.665569671 -0800
***************
*** 49,60 ****
"""
removeNameSpace(xml) -- remove top-level AWS namespace
"""
r = re.compile('^(<?[^>]+?>\s?)(<\w+) xmlns=[\'"](http://[^\'"]+)[\'"](.*)', re.MULTILINE)
if r.match(xml):
xmlns = r.match(xml).groups()[2]
xml = r.sub("\\1\\2\\4", xml)
else:
! xmlns = None
return xml, xmlns
def getTreeFromXml(xml):
--- 49,67 ----
"""
removeNameSpace(xml) -- remove top-level AWS namespace
"""
+ # S3 returns doctype, xmlns
r = re.compile('^(<?[^>]+?>\s?)(<\w+) xmlns=[\'"](http://[^\'"]+)[\'"](.*)', re.MULTILINE)
if r.match(xml):
xmlns = r.match(xml).groups()[2]
xml = r.sub("\\1\\2\\4", xml)
else:
! # Eucalyptus returns xmlns, xmlns:xsi
! r = re.compile('^(<\w+) xmlns=[\'"](http://[^\'"]+)[\'"] xmlns:xsi=[\'"]http://[^\'"]+[\'"](.*)', re.MULTILINE)
! if r.match(xml):
! xmlns = r.sub("\\2", xml)
! xml = r.sub("\\1\\3", xml)
! else:
! xmlns = None
return xml, xmlns
def getTreeFromXml(xml):
Binary files /usr/share/s3cmd/S3/Utils.pyc and ./S3/Utils.pyc differ
diff -cr -r /usr/share/s3cmd/s3cmd ./s3cmd
*** /usr/share/s3cmd/s3cmd 2009-11-07 12:02:37.000000000 -0800
--- ./s3cmd 2011-02-24 17:57:20.863091004 -0800
***************
*** 130,141 ****
format_string = u"%(timestamp)16s %(size)9s%(coeff)1s %(uri)s"
for prefix in response['common_prefixes']:
output(format_string % {
"timestamp": "",
"size": "DIR",
"coeff": "",
"md5": "",
! "uri": uri.compose_uri(bucket, prefix["Prefix"])})
for object in response["list"]:
size, size_coeff = formatSize(object["Size"], Config().human_readable_sizes)
--- 130,148 ----
format_string = u"%(timestamp)16s %(size)9s%(coeff)1s %(uri)s"
for prefix in response['common_prefixes']:
+ try:
+ # S3 often has / as prefix at minimum
+ prefixprefix = prefix["Prefix"]
+ except KeyError:
+ # Eucalyptus often has an empty prefix which doesn't
+ # parse, it puts thins in "Directory" instead
+ prefixprefix = ""
output(format_string % {
"timestamp": "",
"size": "DIR",
"coeff": "",
"md5": "",
! "uri": uri.compose_uri(bucket, prefixprefix)})
for object in response["list"]:
size, size_coeff = formatSize(object["Size"], Config().human_readable_sizes)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.