1 # SPDX-License-Identifier: EPL-1.0
2 ##############################################################################
3 # Copyright (c) 2018 The Linux Foundation and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Eclipse Public License v1.0
7 # which accompanies this distribution, and is available at
8 # http://www.eclipse.org/legal/epl-v10.html
9 ##############################################################################
10 # Ensures that we are only ever using one robot system
12 # Due to the way the Jenkins OpenStack Cloud plugin works we can only limit
13 # max parallel robot systems by the VM. So having multiple VM types makes it
14 # very difficult for us to properly limit the amount of parallel robot runs.
16 __author__ = 'Thanh Ha'
25 def get_robot_systems(filename):
26 """Scan for robot vms.
28 Returns a list of Robot systems found in file.
32 with open(filename, 'r') as _file:
33 for num, line in enumerate(_file, 1):
34 if re.search('centos7-robot', line):
35 robots.add(line.rsplit(maxsplit=1)[1])
40 if __name__ == "__main__":
42 for root, dirnames, filenames in os.walk('jjb'):
43 for filename in fnmatch.filter(filenames, '*.yaml'):
44 robots += get_robot_systems(os.path.join(root, filename))
47 print("ERROR: More than one robot system type definition detected.")
48 print("Please ensure that ALL templates use the same robot nodes.")
49 print("Infra does not support more than 1 robot node type in use.")