Skip to content

Commit

Permalink
fix: 🐛 arkstore error message
Browse files Browse the repository at this point in the history
  • Loading branch information
luolu-lg committed Jul 28, 2022
1 parent ee9eac0 commit fedee12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 8 additions & 8 deletions arkid/common/arkstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def get_arkstore_access_token_with_saas_token(saas_tenant_slug, saas_tenant_id,
resp = requests.get(app_login_url, params=params)
if resp.status_code != 200:
arkstore_access_token_saas_cache.pop(key, None)
raise Exception(f'Error get_arkstore_access_token: {resp.status_code}')
raise Exception(f'Error get_arkstore_access_token_with_saas_token: {resp.status_code}')
resp = resp.json()
arkstore_access_token_saas_cache[key] = resp['access_token']
return arkstore_access_token_saas_cache[key]
Expand Down Expand Up @@ -153,7 +153,7 @@ def get_arkstore_extension_detail_by_package(access_token, package):
if resp.status_code == 404:
return
if resp.status_code != 200:
raise Exception(f'Error get_arkstore_extension_detail: {resp.status_code}')
raise Exception(f'Error get_arkstore_extension_detail_by_package: {resp.status_code}')
resp = resp.json()
return resp

Expand Down Expand Up @@ -349,7 +349,7 @@ def get_bind_arkstore_agent(access_token):
if resp.status_code == 204:
return {}
if resp.status_code != 200:
raise Exception(f'Error bind_arkstore_agent: {resp.status_code}')
raise Exception(f'Error get_bind_arkstore_agent: {resp.status_code}')
resp = resp.json()
return resp

Expand Down Expand Up @@ -462,7 +462,7 @@ def get_arkstore_app_detail(access_token, app_id):
params = {}
resp = requests.get(arkstore_extensions_url, params=params, headers=headers)
if resp.status_code != 200:
raise Exception(f'Error get_arkstore_extension_detail: {resp.status_code}')
raise Exception(f'Error get_arkstore_app_detail: {resp.status_code}')
resp = resp.json()
return resp

Expand All @@ -474,7 +474,7 @@ def get_arkid_saas_app_detail(tenant, token, extension_id):
params = {}
resp = requests.get(arkid_saas_app_url, params=params, headers=headers)
if resp.status_code != 200:
raise Exception(f'Error get_arkstore_extension_detail: {resp.status_code}')
raise Exception(f'Error get_arkid_saas_app_detail: {resp.status_code}')
resp = resp.json()
return resp

Expand All @@ -486,7 +486,7 @@ def check_arkstore_app_purchased(tenant, token, app):
params = {}
resp = requests.get(order_url, params=params, headers=headers, timeout=10)
if resp.status_code != 200:
raise Exception(f'Error check_arkstore_purchased: {resp.status_code}')
raise Exception(f'Error check_arkstore_app_purchased: {resp.status_code}')
resp = resp.json()
if resp.get("use_end_time") == '0':
return True
Expand Down Expand Up @@ -566,7 +566,7 @@ def get_arkstore_extensions_rented(access_token, offset=0, limit=10):
params = {'leased': 'true'}
resp = requests.get(arkstore_extensions_url, params=params, headers=headers)
if resp.status_code != 200:
raise Exception(f'Error get_arkstore_apps_and_extensions: {resp.status_code}')
raise Exception(f'Error get_arkstore_extensions_rented: {resp.status_code}')
resp = resp.json()
return resp

Expand All @@ -579,7 +579,7 @@ def get_arkstore_extensions_purchased(access_token, offset=0, limit=10):
params = {'purchased': 'true'}
resp = requests.get(arkstore_extensions_url, params=params, headers=headers)
if resp.status_code != 200:
raise Exception(f'Error get_arkstore_apps_and_extensions: {resp.status_code}')
raise Exception(f'Error get_arkstore_extensions_purchased: {resp.status_code}')
resp = resp.json()
return resp

Expand Down
3 changes: 3 additions & 0 deletions arkid/core/perm/event_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def user_saved(sender, instance: User, created: bool, **kwargs):
def tenant_saved(sender, instance: Tenant, created: bool, **kwargs):
if created:
# print('检测到租户创建')
from arkid.common.bind_saas import bind_saas
bind_saas(instance.id.hex)

pd = PermissionData()
pd.create_tenant_admin_permission(instance)

Expand Down

0 comments on commit fedee12

Please sign in to comment.