]>
git.ipfire.org Git - ipfire.org.git/blob - build/rpc.py
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2008,2009 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
28 from builder
import Builder
, getAllBuilders
29 from constants
import config
31 ALLOWED_ACTIONS_SET
= ( "distcc", "duration", "hostname", "jobs", "log", "state",
32 "package", "target", "toolchain", "cpu", "machine", "system",)
33 ALLOWED_ACTIONS_GET
= ( "distcc",)
35 def run(uuid
, action
):
36 myself
= Builder(config
, uuid
)
39 for key
in ALLOWED_ACTIONS_GET
:
41 for value
in data
.getlist(key
):
43 builders
= getAllBuilders()
45 for builder
in builders
:
46 # Print "localhost" for ourself
47 if myself
.uuid
== builder
.uuid
:
50 if ((myself
.toolchain() == builder
.toolchain()) and \
51 (myself
.machine() == builder
.machine()) and \
52 (myself
.target() == builder
.target())):
53 print "%s" % (builder
.distcc
,)
56 for key
in ALLOWED_ACTIONS_SET
:
57 for value
in data
.getlist(key
):
58 print myself
.set(key
, value
)
60 data
= cgi
.FieldStorage()
62 print "Status: 200 - OK" # We always send okay.
66 uuid
= data
.getfirst("uuid")
67 action
= data
.getfirst("action")