Revision e31e4274 snf-pithos-backend/pithos/backends/lib/sqlalchemy/alembic/versions/165ba3fbfe53_update_path_account.py
b/snf-pithos-backend/pithos/backends/lib/sqlalchemy/alembic/versions/165ba3fbfe53_update_path_account.py | ||
---|---|---|
30 | 30 |
try: |
31 | 31 |
uuid = get_user_uuid( |
32 | 32 |
SERVICE_TOKEN, account, USER_CATALOG_URL, AUTHENTICATION_USERS) |
33 |
except Exception, e: |
|
34 |
print 'Unable to retrieve uuid for %s: %s' % (account, e) |
|
35 |
return |
|
33 |
except: |
|
34 |
raise |
|
36 | 35 |
else: |
37 | 36 |
if uuid: |
38 | 37 |
catalog[account] = uuid |
... | ... | |
47 | 46 |
try: |
48 | 47 |
displayname = get_user_displayname( |
49 | 48 |
SERVICE_TOKEN, account, USER_CATALOG_URL, AUTHENTICATION_USERS) |
50 |
except Exception, e: |
|
51 |
print 'Unable to retrieve displayname for %s: %s' % (account, e) |
|
52 |
return |
|
49 |
except: |
|
50 |
raise |
|
53 | 51 |
else: |
54 | 52 |
if displayname: |
55 | 53 |
catalog[account] = displayname |
... | ... | |
89 | 87 |
|
90 | 88 |
def upgrade(): |
91 | 89 |
connection = op.get_bind() |
92 |
|
|
90 |
|
|
93 | 91 |
s = sa.select([n.c.node, n.c.path]) |
94 | 92 |
nodes = connection.execute(s).fetchall() |
95 | 93 |
for node, path in nodes: |
... | ... | |
100 | 98 |
path = sep.join([uuid, rest]) |
101 | 99 |
u = n.update().where(n.c.node == node).values({'path':path}) |
102 | 100 |
connection.execute(u) |
103 |
|
|
101 |
|
|
104 | 102 |
s = sa.select([p.c.public_id, p.c.path]) |
105 | 103 |
public = connection.execute(s).fetchall() |
106 | 104 |
for id, path in public: |
... | ... | |
111 | 109 |
path = sep.join([uuid, rest]) |
112 | 110 |
u = p.update().where(p.c.public_id == id).values({'path':path}) |
113 | 111 |
connection.execute(u) |
114 |
|
|
112 |
|
|
115 | 113 |
s = sa.select([x.c.feature_id, x.c.path]) |
116 | 114 |
xfeatures = connection.execute(s).fetchall() |
117 | 115 |
for id, path in xfeatures: |
Also available in: Unified diff