diff --git a/TODO b/TODO index 27220d1..db13de2 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,6 @@ -Figure out best way to connect to KVM, ssh password is cumbersome. --Make sure disks get cleaned up + -Look into openssh-askpass +-Show actions in web pages and CLI -Add kibana support -Add Graphana support -Create a style for the web pages diff --git a/testpool/core/coding.py b/testpool/core/coding.py index 351c788..48c4617 100644 --- a/testpool/core/coding.py +++ b/testpool/core/coding.py @@ -1,14 +1,27 @@ -class curry: - def __init__(self, fun, *args, **kwargs): - self.fun = fun +""" +Coding concepts. +""" + + +# pylint: disable=R0903 +class Curry(object): + """ Supports curry algorithm. + defer calling a function with a specific set of parameters. + """ + + def __init__(self, func, *args, **kwargs): + """ Store arguments and function for later. """ + self.func = func self.pending = args[:] self.kwargs = kwargs.copy() def __call__(self, *args, **kwargs): + """ Call's the self.func with arguments now. """ + if kwargs and self.kwargs: - kw = self.kwargs.copy() - kw.update(kwargs) + kwarg = self.kwargs.copy() + kwarg.update(kwargs) else: - kw = kwargs or self.kwargs + kwarg = kwargs or self.kwargs - return self.fun(*(self.pending + args), **kw) + return self.func(*(self.pending + args), **kwarg) diff --git a/testpool/core/server.py b/testpool/core/server.py index 31d8bc4..e61c04a 100644 --- a/testpool/core/server.py +++ b/testpool/core/server.py @@ -302,7 +302,7 @@ def main(args): args.max_sleep_time) time.sleep(args.max_sleep_time) elif vmh.action_time < current or args.max_sleep_time == 0: - exceptions.try_catch(coding.curry(action_vm, vmh)) + exceptions.try_catch(coding.Curry(action_vm, vmh)) else: action_delay = abs(vmh.action_time - current).seconds