blob: fbdc2a988635e4a68038e2604c04630888697ba7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# Copyright 2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
from buildbot.plugins import worker
class gentoo_ci_workers():
def __init__(self, worker_data, **kwargs):
self.worker_data = worker_data
def getLocalWorkersUuid(self):
local_worker = []
for worker in self.worker_data:
if worker['type'] == 'local' and worker['enable'] is True:
local_worker.append(worker['uuid'])
print(local_worker)
return local_worker
def getBuildWorkersUuid(self):
build_worker = []
for worker in self.worker_data:
if (worker['type'] != 'local' and worker['type'] != 'node') and worker['enable'] is True:
build_worker.append(worker['uuid'])
print(build_worker)
return build_worker
def getBuildWorkersAllData(self):
build_worker = []
for worker in self.worker_data:
if (worker['type'] != 'local' and worker['type'] != 'node') and worker['enable'] is True:
build_worker.append(worker)
print(build_worker)
return build_worker
def getNodeWorkersUuid(self):
node_worker = []
for worker in self.worker_data:
if worker['type'] == 'node' and worker['enable'] is True:
node_worker.append(worker['uuid'])
print(node_worker)
return node_worker
def getNodedWorkersAllData(self):
node_worker = []
for worker in self.worker_data:
if worker['type'] == 'node' and worker['enable'] is True:
node_worker.append(worker)
print(node_worker)
return node_worker
def gentoo_workers(worker_data):
w = []
g_ci_w = gentoo_ci_workers(worker_data)
LocalWorkers = g_ci_w.getLocalWorkersUuid()
BuildWorkers = g_ci_w.getBuildWorkersAllData()
NodeWorkers = g_ci_w.getNodedWorkersAllData()
for local_worker in LocalWorkers:
w.append(worker.LocalWorker(local_worker))
for build_worker in BuildWorkers:
if build_worker['type'] == 'default':
w.append(worker.Worker(build_worker['uuid'], build_worker['password']))
for node_worker in NodeWorkers:
if node_worker['type'] == 'node':
w.append(worker.Worker(node_worker['uuid'], node_worker['password']))
return w
|