Commit 692d84f0 authored by Sébastien Luttringer's avatar Sébastien Luttringer
Browse files

Add purge command

parent e88fe279
Loading
Loading
Loading
Loading
+29 −0
Original line number Original line Diff line number Diff line
#!/usr/bin/env python
#coding=utf8

'''
CloudControl cancel command
'''

from cccli.exception import *
from sjrpc.core.exceptions import *
from cccli.printer import Printer, color
from cccli.command import TqlCommand

class Command_purge(TqlCommand):
    '''Purge a job (delete it)'''

    def __init__(self, cli, argv0):
        TqlCommand.__init__(self, cli, argv0)
        self.tql_filter += "&r=job&state=done"

    def __call__(self, argv):
        # arg parse
        self.parse_args(argv)
        if len(self.args) != 1:
            raise cmdBadArgument()
        # rpc call
        self.rpccall("purge", self.args[0])

    def remote_functions(self):
        return set(("purge",))