Merge lp:~thedac/simplestreams/lp1719879 into lp:simplestreams

Proposed by David Ames
Status: Merged
Merged at revision: 454
Proposed branch: lp:~thedac/simplestreams/lp1719879
Merge into: lp:simplestreams
Diff against target: 38 lines (+12/-4)
2 files modified
simplestreams/objectstores/swift.py (+8/-3)
simplestreams/openstack.py (+4/-1)
To merge this branch: bzr merge lp:~thedac/simplestreams/lp1719879
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
simplestreams-dev Pending
Review via email: mp+333011@code.launchpad.net

Description of the change

Fix KSv3 Bugs

This change fixes two bugs.

One, when using keystoneauth1 sessions with swiftclient less than
3.3.0, catch the TypeError and use the old Connection method.

Two, the glance mirror would check if tenant_id matched before
recognizing an existing image. This cause duplicate images to be
uploaded. With keystoneauth1 sessions use a method to get the
project id.

LP: #1719879

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

David,
Thanks. this looks good.

I opened bug 1728982 for the 'tenant_id' issue, and will merge this under two separate commits.

Revision history for this message
Scott Moser (smoser) wrote :

This went in in 2 pieces, upstream commit 454 and 453.
thanks David.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'simplestreams/objectstores/swift.py'
2--- simplestreams/objectstores/swift.py 2017-09-01 23:14:24 +0000
3+++ simplestreams/objectstores/swift.py 2017-10-30 23:03:50 +0000
4@@ -35,9 +35,14 @@
5 connargs.update({k: kwargs.get(k) for k in pt if k in kwargs})
6 if kwargs.get('session'):
7 sess = kwargs.get('session')
8- return Connection(session=sess)
9- else:
10- return Connection(**connargs)
11+ try:
12+ # If session is available try it
13+ return Connection(session=sess)
14+ except TypeError:
15+ # The edge case where session is availble but swiftclient is
16+ # < 3.3.0. Use the old style method for Connection.
17+ pass
18+ return Connection(**connargs)
19
20
21 class SwiftContentSource(cs.IteratorContentSource):
22
23=== modified file 'simplestreams/openstack.py'
24--- simplestreams/openstack.py 2017-09-11 16:00:49 +0000
25+++ simplestreams/openstack.py 2017-10-30 23:03:50 +0000
26@@ -179,9 +179,12 @@
27 client = get_ksclient(**kwargs)
28
29 endpoint = _get_endpoint(client, service, **kwargs)
30+ # Session client does not have tenant_id set at client.tenant_id
31+ # If client.tenant_id not set use method to get it
32+ tenant_id = client.tenant_id or client.auth.client.get_project_id()
33 info = {'token': client.auth_token, 'insecure': kwargs.get('insecure'),
34 'cacert': kwargs.get('cacert'), 'endpoint': endpoint,
35- 'tenant_id': client.tenant_id}
36+ 'tenant_id': tenant_id}
37 if not _LEGACY_CLIENTS:
38 info['session'] = client.session
39

Subscribers

People subscribed via source and target branches

to all changes: