0001-fixup-9210.patch
wcs/wf/roles.py | ||
---|---|---|
16 | 16 | |
17 | 17 |
import urlparse |
18 | 18 |
import urllib |
19 |
import sys |
|
19 | 20 | |
20 | 21 |
from quixote import get_request, get_publisher, get_response |
21 | 22 |
from qommon.form import * |
... | ... | |
27 | 28 |
from wcs.api import sign_url |
28 | 29 | |
29 | 30 | |
31 |
class MissingSecret(Exception): |
|
32 |
pass |
|
33 | ||
34 | ||
30 | 35 |
def get_secret(url): |
31 | 36 |
domain = urlparse.urlparse(url).netloc.split(':')[0] |
32 |
secret = get_publisher().get_site_option(domain, 'api-secrets') |
|
37 |
secret = get_publisher().get_site_option(domain, 'wscall-secrets') |
|
38 |
if not secret: |
|
39 |
raise MissingSecret() |
|
33 | 40 |
return secret |
34 | 41 | |
35 | 42 | |
... | ... | |
95 | 102 |
role = Role.get(self.role_id) |
96 | 103 |
role_uuid = role.slug |
97 | 104 |
user_uuid = user.name_identifiers[0] |
98 |
url = roles_ws_url(role_uuid, user_uuid) |
|
105 |
try: |
|
106 |
url = roles_ws_url(role_uuid, user_uuid) |
|
107 |
except MissingSecret: |
|
108 |
get_publisher().notify_of_exception(sys.exc_info(), context='[ROLES]') |
|
109 |
return |
|
99 | 110 |
def after_job(job): |
100 | 111 |
response, status, data, auth_header = http_post_request(url) |
101 | 112 |
if status != 201: |
... | ... | |
149 | 160 |
role = Role.get(self.role_id) |
150 | 161 |
role_uuid = role.slug |
151 | 162 |
user_uuid = user.name_identifiers[0] |
152 |
url = roles_ws_url(role_uuid, user_uuid) |
|
163 |
try: |
|
164 |
url = roles_ws_url(role_uuid, user_uuid) |
|
165 |
except MissingSecret: |
|
166 |
get_publisher().notify_of_exception(sys.exc_info(), context='[ROLES]') |
|
167 |
return |
|
153 | 168 |
def after_job(job): |
154 | 169 |
response, status, data, auth_header = http_delete_request(url) |
155 | 170 |
if status != 200: |
156 |
- |