From 5aeef33219103eb5f39bfc0a79ed462f46a12420 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 6 Apr 2018 21:38:43 +0300 Subject: Add: authentication URL to controller /version --- ick2/controllerapi.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'ick2/controllerapi.py') diff --git a/ick2/controllerapi.py b/ick2/controllerapi.py index f7c71f6..9785384 100644 --- a/ick2/controllerapi.py +++ b/ick2/controllerapi.py @@ -23,14 +23,24 @@ class ControllerAPI: self._apis = {} def set_artifact_store_url(self, url): # pragma: no cover - self.find_missing_route('/version') - api = self._apis.get('/version') + self._set_url('set_artifact_store_url', url) + + def set_auth_url(self, url): # pragma: no cover + self._set_url('set_auth_url', url) + + def _set_url(self, what, url): # pragma: no cover + api = self._get_version_api() if api: - api.set_artifact_store_url(url) + method = getattr(api, what) + method(url) ick2.log.log( - 'info', msg_text='Set artifact store url', url=url, + 'info', msg_text='Set url', what=what, url=url, version=api.get_version()) + def _get_version_api(self): # pragma: no cover + self.find_missing_route('/version') + return self._apis.get('/version') + def find_missing_route(self, missing_path): # pragma: no cover apis = { '/version': ick2.VersionAPI, -- cgit v1.2.1