1
# Copyright (C) 2010, 2011 Linaro
3
# Author: James Tunnicliffe <james.tunnicliffe@linaro.org>
5
# This file is part of Linaro CI CLI.
7
# Linaro CI CLI 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
# Linaro CI CLI 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 Linaro Image Tools. If not, see <http://www.gnu.org/licenses/>.
21
from base_command import BaseCommandNeedsAuth, CommandFailed
25
Defines the lci run command
28
class Command(BaseCommandNeedsAuth):
30
parameters = self._args_to_params(args)
32
print "Run task with params %s" % parameters
34
r = self.get("run", parameters)
36
if r.status_code != requests.codes.ok:
37
raise CommandFailed(self.name, parameters, r)
39
def _args_to_params(self, parameters):
41
parser = argparse.ArgumentParser(description='Linaro CI: Run task.',
42
prog=self.program_name)
43
parser.add_argument('job_name', type=str,
44
help='Job name specified in configuration file.')
46
args = parser.parse_args(parameters)