From e4604e40a451150d2d5f8bef9d6a9c8dfc00c6d6 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 18 Oct 2019 10:49:33 +0300 Subject: Revert "Change: get and use tokens" This reverts commit 4dd2e14cd15ad2840cfc3636251802f8eb0bc9ba. --- ick2/projectapi.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'ick2/projectapi.py') diff --git a/ick2/projectapi.py b/ick2/projectapi.py index a854716..0d9f8f5 100644 --- a/ick2/projectapi.py +++ b/ick2/projectapi.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2019 Lars Wirzenius +# Copyright (C) 2017-2018 Lars Wirzenius # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -50,17 +50,16 @@ class ProjectAPI(ick2.ResourceApiBase): ] def trigger_project(self, project, **kwargs): # pragma: no cover - token = 'FIXME' - with self._trans.modify(token, 'projects', project) as p: - self._start_build(token, p) + with self._trans.modify('projects', project) as p: + self._start_build(p) return {'status': ick2.BUILD_TRIGGERED} - def _start_build(self, token, project): # pragma: no cover + def _start_build(self, project): # pragma: no cover build_no = self._pick_build_number(project) build_id = '{}/{}'.format(project['project'], build_no) ick2.log.log('info', msg_text='Starting new build', build_id=build_id) - with self._trans.new(token, 'builds', build_id) as build: + with self._trans.new('builds', build_id) as build: parameters = project.get('parameters', {}) build.from_dict({ 'build_id': build_id, @@ -82,10 +81,10 @@ class ProjectAPI(ick2.ResourceApiBase): build_obj = ick2.Build(build) graph = build_obj.get_graph() graph.append_action(create_workspace) - for action in self._get_actions(token, project): + for action in self._get_actions(project): graph.append_action(action) - with self._trans.new(token, 'log', build_id) as r: + with self._trans.new('log', build_id) as r: r.from_dict({ 'build_id': build_id, 'log': '', @@ -102,12 +101,11 @@ class ProjectAPI(ick2.ResourceApiBase): old_build_no=old_build_no, build_no=build_no) return build_no - def _get_actions(self, token, project): # pragma: no cover + def _get_actions(self, project): # pragma: no cover actions = [] params = project.get('parameters', {}) for pipeline_name in project.get('pipelines', []): - pipeline = self._trans.get_resource( - token, 'pipelines', pipeline_name) + pipeline = self._trans.get_resource('pipelines', pipeline_name) wanted = pipeline.get('parameters', []) missing = [ name -- cgit v1.2.1