Skip to content
Snippets Groups Projects
Commit d3fbb751 authored by geant-release-service's avatar geant-release-service
Browse files

Finished release 0.70.

parents 6dc9044f 5cc300ed
No related branches found
No related tags found
No related merge requests found
...@@ -160,15 +160,12 @@ def get_or_create_service_account(request: AdminRequest, org_id): ...@@ -160,15 +160,12 @@ def get_or_create_service_account(request: AdminRequest, org_id):
raise e raise e
# create a service account for provisioning # create a service account for provisioning
try: result = request.post(
result = request.post( 'api/serviceaccounts', json={
'api/serviceaccounts', json={ 'name': 'provision',
'name': 'provision', 'role': 'Admin',
'role': 'Admin', 'isDisabled': False,
'isDisabled': False, }).json()
}).json()
except HTTPError as e:
print(e)
logger.info(f'Created provision service account for organization #{org_id}') logger.info(f'Created provision service account for organization #{org_id}')
return result return result
......
...@@ -839,9 +839,10 @@ def provision(config, raise_exceptions=False): ...@@ -839,9 +839,10 @@ def provision(config, raise_exceptions=False):
all_orgs = _provision_orgs(config) all_orgs = _provision_orgs(config)
request = AdminRequest(**config) request = AdminRequest(**config)
try: try:
# needed for older versions of grafana (<11.0)
delete_expired_api_tokens(request) delete_expired_api_tokens(request)
except Exception: except Exception:
pass # needed for older versions of grafana pass
def _find_org_config(org): def _find_org_config(org):
orgs_to_provision = config.get('organizations', DEFAULT_ORGANIZATIONS) orgs_to_provision = config.get('organizations', DEFAULT_ORGANIZATIONS)
...@@ -865,13 +866,14 @@ def provision(config, raise_exceptions=False): ...@@ -865,13 +866,14 @@ def provision(config, raise_exceptions=False):
continue continue
try: try:
token = create_api_token(request, org_id)
accounts.append((org_id, token))
except Exception:
# create a service account for provisioning (>grafana 11.0) # create a service account for provisioning (>grafana 11.0)
account = get_or_create_service_account(request, org_id) account = get_or_create_service_account(request, org_id)
token = create_service_account_token(request, account['id']) token = create_service_account_token(request, account['id'])
accounts.append((org_id, account)) accounts.append((org_id, account))
except Exception:
# we're on a older version of grafana
token = create_api_token(request, org_id)
accounts.append((org_id, token))
token_request = TokenRequest(token=token['key'], **config) token_request = TokenRequest(token=token['key'], **config)
logger.debug(accounts) logger.debug(accounts)
...@@ -938,10 +940,10 @@ def provision(config, raise_exceptions=False): ...@@ -938,10 +940,10 @@ def provision(config, raise_exceptions=False):
delete_unknown_folders(token_request, folders_to_keep) delete_unknown_folders(token_request, folders_to_keep)
try: try:
delete_api_token(request, token['id'], org_id=org_id)
except Exception:
# we're on a newer version of grafana
delete_service_account(request, account['id']) delete_service_account(request, account['id'])
except Exception:
# we're on a older version of grafana
delete_api_token(request, token['id'], org_id=org_id)
except Exception: except Exception:
logger.exception(f'Error when provisioning org {org["name"]}') logger.exception(f'Error when provisioning org {org["name"]}')
if raise_exceptions: if raise_exceptions:
......
...@@ -989,7 +989,7 @@ def get_dashboard_data( ...@@ -989,7 +989,7 @@ def get_dashboard_data(
): ):
yield dash yield dash
finally: finally:
executor.shutdown(wait=False, cancel_futures=True) executor.shutdown(wait=False)
def create_aggregate_panel(title, gridpos, targets, datasource): def create_aggregate_panel(title, gridpos, targets, datasource):
......
...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages ...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup( setup(
name='brian-dashboard-manager', name='brian-dashboard-manager',
version="0.69", version="0.70",
author='GEANT', author='GEANT',
author_email='swd@geant.org', author_email='swd@geant.org',
description='', description='',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment