]>
git.ipfire.org Git - ipfire.org.git/blob - src/scripts/ipfire.org.in
9 class TaskRunner(object):
10 def __init__(self
, *args
, **kwargs
):
11 self
.backend
= ipfire
.Backend(*args
, **kwargs
)
14 self
.ioloop
= tornado
.ioloop
.IOLoop
.current()
16 def run_task(self
, name
, *args
, **kwargs
):
18 This method runs the task with the given name and
19 arguments asynchronically and exits the program in
20 case on a non-zero exit code
22 @tornado.gen
.coroutine
24 yield self
.backend
.run_task(name
, *args
, **kwargs
)
26 return self
.ioloop
.run_sync(task
)
30 z
= TaskRunner("@configsdir@/@PACKAGE_NAME@.conf")
33 sys
.stderr
.write("Argument needed\n")
36 basename
= sys
.argv
[0]
41 z
.run_task(task
, *args
)