Source code for taboot.tasks.command

# -*- coding: utf-8 -*-
# Taboot - Client utility for performing deployments with Func.
# Copyright © 2009,2010, Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from taboot.tasks import FuncTask, TaskResult


[docs]class Run(FuncTask): """ Run arbitrary commands via Func. The arguments passed to __init__ are used to execute func.overlord.Client.command.run(args). :Parameters: - `command`: Command to run on the remote host """ def __init__(self, command, **kwargs): super(Run, self).__init__(command, **kwargs) self._command = 'command.run' def _process_result(self, result): t = TaskResult(self) if result[0] == 0: t.success = True else: t.success = False t.output = result[1] return t