allow ignored Harbor projects to be configurable

pull/45/head
Max Erenberg 11 months ago
parent 7ec17b2b4d
commit 02598fa3bc
  1. 4
      ceo_common/model/Config.py
  2. 6
      ceod/model/ContainerRegistryService.py
  3. 1
      etc/ceod.ini
  4. 1
      tests/ceod_dev.ini
  5. 1
      tests/ceod_test_local.ini

@ -27,6 +27,8 @@ class Config:
return True
if val.lower() in ['false', 'no']:
return False
if section.startswith('auxiliary ') or section == 'positions':
# We should do something about this...
if section.startswith('auxiliary ') or section == 'positions' or \
(section == 'registry' and key == 'projects_to_ignore'):
return [item.strip() for item in val.split(',')]
return val

@ -19,6 +19,7 @@ class ContainerRegistryService:
api_username = cfg.get('registry_username')
api_password = cfg.get('registry_password')
self.basic_auth = HTTPBasicAuth(api_username, api_password)
self.projects_to_ignore = cfg.get('registry_projects_to_ignore')
def _http_request(self, method: str, path: str, **kwargs):
return requests.request(
@ -45,12 +46,9 @@ class ContainerRegistryService:
# we're actually just going to get a list of projects
resp = self._http_get('/projects')
resp.raise_for_status()
# This project is only owned by the admin account, so we don't
# want to include it
project_exceptions = ['library']
return [
project['name'] for project in resp.json()
if project['name'] not in project_exceptions
if project['name'] not in self.projects_to_ignore
]
def create_project_for_user(self, username: str):

@ -105,3 +105,4 @@ server_url = https://172.19.134.149:6443
base_url = https://registry.cloud.csclub.uwaterloo.ca/api/v2.0
username = REPLACE_ME
password = REPLACE_ME
projects_to_ignore = library, openwhisk

@ -99,3 +99,4 @@ server_url = https://172.19.134.149:6443
base_url = http://localhost:8002/api/v2.0
username = REPLACE_ME
password = REPLACE_ME
projects_to_ignore = library,openwhisk

@ -98,3 +98,4 @@ server_url = https://172.19.134.149:6443
base_url = http://localhost:8002/api/v2.0
username = REPLACE_ME
password = REPLACE_ME
projects_to_ignore = library, openwhisk

Loading…
Cancel
Save