swiftclient raises Exception about resource not found
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ospurge |
Invalid
|
Undecided
|
Unassigned |
Bug Description
When I try to cleanup a project, I get an error from swiftclient.
I'm working on devstack stable/mitaka, the command is the following:
~/projects/ospurge $ ospurge --cleanup-project proj01
Traceback (most recent call last):
File "/home/
sys.
File "/home/
args.insecure, **data)
File "/home/
res_
File "/home/
resources = self.list()
File "/home/
for cont in self.list_
File "/home/
http_
File "/home/
raise ClientException
swiftclient.
HTTP traffic reports what I think is a wrong endpoint for the account details request:
GET /?format=json
instead of
GET /v1/{account}
The trace is the following
GET /?format=json HTTP/1.1
Host: 192.168.122.15:8080
user-agent: python-
accept-encoding: gzip
x-auth-token: c01ebcff9b95460
HTTP/1.1 404 Not Found
Content-Length: 70
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txa29bf16be1654
Date: Thu, 01 Dec 2016 16:00:06 GMT
<html><h1>Not Found</h1><p>The resource could not be found.</p></html>
I modified the following lines and it seems to be working fine:
--- a/ospurge/client.py
+++ b/ospurge/client.py
@@ -59,15 +59,11 @@ class SwiftResources(
self.token = self.session.token
- conn = swift_client.
- insecure=
- self.http_conn = conn.parsed_url, conn
+ self.conn = swift_client.
# This method is used to retrieve Objects as well as Containers.
def list_containers
- containers = swift_client.
- self.token,
- http_conn=
+ containers = self.conn.
return (cont['name'] for cont in containers)
@@ -77,17 +73,13 @@ class SwiftObjects(
for cont in self.list_
objs = [{'container': cont, 'name': obj['name']} for obj in
- swift_client.
- self.token,
- cont,
- http_conn=
+ self.conn.
return swift_objects
def delete(self, obj):
- swift_client.
- container=
+ self.conn.
def resource_str(self, obj):
return "object {} in container {}".format(
@@ -101,7 +93,7 @@ class SwiftContainers
def delete(self, container):
- swift_client.
+ self.conn.
def resource_str(self, obj):
return "container {}".format(obj)
Now that ospurge has been rewritten (https:/ /review. openstack. org/#/c/ 406160/) I believe this is not a valid bug anymore. Please reopen if need be.