[lnst] NetTestCommand: Removing a forgotten debug print
by Jiří Pírko
commit 5d4a49cebbfa9a692d8aa48baa9f94662c03ff55
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Thu Aug 8 11:03:13 2013 +0200
NetTestCommand: Removing a forgotten debug print
I accidentally left two debug print messages in the NetTestCommand
class in one of the series I posted earlier. This patch just removes
them.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Common/NetTestCommand.py | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
---
diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py
index d246795..08228d9 100644
--- a/lnst/Common/NetTestCommand.py
+++ b/lnst/Common/NetTestCommand.py
@@ -172,8 +172,6 @@ class NetTestCommand:
os.killpg(os.getpgid(self._pid), signal.SIGINT)
def kill(self):
- print self, dir(self)
- print self._cmd_cls
if os.path.exists("/proc/%d" % self._pid):
if self._id:
logging.debug("Killing background command with id \"%s\", pid \"%d\"" % (self._id, self._pid))
10 years, 8 months
[PATCH] tcp_conn: add initialization of sigaction variables
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
Without the initialization these variables sometimes contain garbage
data in the .sa_flags field, that makes the signal handling be reset
after recieving the specified signal once. This results in the parent
process being killed by a child process.
---
test_tools/tcp_conn/tcp_connect.c | 2 ++
test_tools/tcp_conn/tcp_listen.c | 3 +++
2 files changed, 5 insertions(+)
diff --git a/test_tools/tcp_conn/tcp_connect.c b/test_tools/tcp_conn/tcp_connect.c
index 598ac80..cb6b8c4 100644
--- a/test_tools/tcp_conn/tcp_connect.c
+++ b/test_tools/tcp_conn/tcp_connect.c
@@ -127,6 +127,8 @@ int main(int argc, char **argv)
char *delimiter;
struct sigaction sa;
+ memset(&sa, 0, sizeof(sa));
+
sa.sa_handler = &terminate_connections;
sigaction(SIGTERM, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
diff --git a/test_tools/tcp_conn/tcp_listen.c b/test_tools/tcp_conn/tcp_listen.c
index df07f69..ef5eeb2 100644
--- a/test_tools/tcp_conn/tcp_listen.c
+++ b/test_tools/tcp_conn/tcp_listen.c
@@ -145,6 +145,9 @@ int main(int argc, char **argv)
struct sigaction sa;
struct sigaction sa2;
+ memset(&sa, 0, sizeof(sa));
+ memset(&sa2, 0, sizeof(sa2));
+
sa.sa_handler = &terminate_connections;
sigaction(SIGTERM, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
--
1.8.3.1
10 years, 8 months
[lnst] remove CNAME from master as it is not needed here
by Jiří Pírko
commit 2b95166bacc323dd2e1acd9af2af853d5e400893
Author: Jiri Pirko <jiri(a)resnulli.us>
Date: Thu Aug 8 13:50:33 2013 +0200
remove CNAME from master as it is not needed here
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
CNAME | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
10 years, 8 months
[PATCH] colours: Fixing multiple bugs with colours
by Radek Pazdera
The default values written to the config were wrong and made the
controller crash on the next invocation.
Another problem was in lnst-slave. The slave script didn't load the
colour configuration from the conf file properly.
Both of them should be fixed now.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
---
lnst-ctl | 2 +-
lnst-slave | 3 +++
lnst/Common/Colours.py | 7 +++++--
lnst/Common/Config.py | 18 +++++++++---------
4 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/lnst-ctl b/lnst-ctl
index 97039ed..7dcace6 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -135,7 +135,7 @@ def main():
elif opt in ("-m", "--no-colours"):
coloured_output = False
- load_presets_from_config()
+ load_presets_from_config(lnst_config)
date = datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S")
log_ctl = LoggingCtl(debug,
diff --git a/lnst-slave b/lnst-slave
index 1e7dee8..ce6c390 100755
--- a/lnst-slave
+++ b/lnst-slave
@@ -18,6 +18,7 @@ import logging
from lnst.Common.Daemon import Daemon
from lnst.Common.Logs import LoggingCtl
from lnst.Common.Config import lnst_config
+from lnst.Common.Colours import load_presets_from_config
from lnst.Slave.NetTestSlave import NetTestSlave
def usage():
@@ -76,6 +77,8 @@ def main():
elif opt in ("-m", "--no-colours"):
coloured_output = False
+ load_presets_from_config(lnst_config)
+
log_ctl = LoggingCtl(debug,
log_dir=lnst_config.get_option('environment', 'log_dir'),
colours=coloured_output)
diff --git a/lnst/Common/Colours.py b/lnst/Common/Colours.py
index c88bf5d..1b72d58 100644
--- a/lnst/Common/Colours.py
+++ b/lnst/Common/Colours.py
@@ -14,7 +14,6 @@ import logging
import os
import re
from lnst.Common.Utils import bool_it
-from lnst.Common.Config import lnst_config
COLOURS = {
"black": 30,
@@ -166,7 +165,11 @@ def decorate_with_preset(string, preset):
def strip_colours(text):
return re.sub("\033\[[0-9]+(;[0-9]+){0,2}m", "", text)
-def load_presets_from_config():
+def get_preset_conf(preset_name):
+ preset = PRESETS[preset_name]
+ return map(lambda s: "default" if s == None else str(s), preset)
+
+def load_presets_from_config(lnst_config):
for preset_name in PRESETS:
preset = lnst_config.get_option("colours", preset_name)
if preset == None:
diff --git a/lnst/Common/Config.py b/lnst/Common/Config.py
index 2a74c25..67921d4 100644
--- a/lnst/Common/Config.py
+++ b/lnst/Common/Config.py
@@ -17,6 +17,7 @@ import re
from ConfigParser import ConfigParser
from lnst.Common.Utils import bool_it
from lnst.Common.NetUtils import verify_ip_address, verify_mac_address
+from lnst.Common.Colours import get_preset_conf
DefaultRPCPort = 9999
@@ -98,16 +99,15 @@ class Config():
def colours_scheme(self):
self.options['colours'] = dict()
- for preset in ["default", "faded", "alert", "highlight",
- "pass", "fail", "error", "info", "debug", "warning",
- "log_header"]:
- self.options['colours'][preset] = {\
- "value" : None, "additive" : False,
- "action" : self.optionColour, "name" : preset}
-
self.options['colours']["disable_colours"] = {\
- "value" : False, "additive" : False,
- "action" : self.optionBool, "name" : "disable_colours"}
+ "value": False, "additive": False,
+ "action": self.optionBool, "name": "disable_colours"}
+
+ for preset in ["faded", "alert", "highlight", "pass", "fail", "error",
+ "info", "debug", "warning", "log_header"]:
+ self.options['colours'][preset] = {\
+ "value": get_preset_conf(preset), "additive": False,
+ "action": self.optionColour, "name": preset}
def get_config(self):
return self.options
--
1.8.3.1
10 years, 8 months
[PATCH] NetTestCommand: Removing a forgotten debug print
by Radek Pazdera
I accidentally left two debug print messages in the NetTestCommand
class in one of the series I posted earlier. This patch just removes
them.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
---
lnst/Common/NetTestCommand.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py
index d246795..08228d9 100644
--- a/lnst/Common/NetTestCommand.py
+++ b/lnst/Common/NetTestCommand.py
@@ -172,8 +172,6 @@ class NetTestCommand:
os.killpg(os.getpgid(self._pid), signal.SIGINT)
def kill(self):
- print self, dir(self)
- print self._cmd_cls
if os.path.exists("/proc/%d" % self._pid):
if self._id:
logging.debug("Killing background command with id \"%s\", pid \"%d\"" % (self._id, self._pid))
--
1.8.3.1
10 years, 8 months
[lnst] add CNAME for github pages
by Jiří Pírko
commit ea192037587e8c871c691bba520ef4c38903c43f
Author: Jiri Pirko <jiri(a)resnulli.us>
Date: Thu Aug 8 10:46:20 2013 +0200
add CNAME for github pages
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
CNAME | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/CNAME b/CNAME
new file mode 100644
index 0000000..b18e061
--- /dev/null
+++ b/CNAME
@@ -0,0 +1 @@
+lnst-project.org
10 years, 8 months
[PATCH 0/3] Python tasks for LNST
by Radek Pazdera
Hello everyone,
This is a followup series to the command sequence refactoring I posted
earlier. While discussing the new design of command sequences, we
agreed, that to get the most variability, we could use python directly
instead of trying to program in XML.
I added a whole new python API for that can be used in parallel to the
original XML tasks in recipes. I tried to put in quite a lot of docs
inline (and I cetainly will put an article up on the wiki). Here's an
example of how it can be used:
You can add a python task to your recipe like this:
<lnstrecipe>
<machines>
<machine id="1">
<interfaces>
<eth network="ttnet" id="testiface"/>
<addresses>
<address value="192.168.100.240/24"/>
</addresses>
</eth>
</interfaces>
</machine>
<machine id="2">
<interfaces>
<eth network="ttnet" id="testiface" type="eth">
<addresses>
<address value="192.168.100.215/24"/>
</addresses>
</eth>
</interfaces>
</machine>
</machines>
<!-- This is it! -->
<task python="task.py"/>
</lnstrecipe>
The path is relative to the location of your recipe. The contens of
the task can look something like the following:
# Mandatory import, the ctl handle contains the API
from lnst.Controller.Task import ctl
# Get handles for the machines
m1 = ctl.get_machine("1")
m2 = ctl.get_machine("2")
# Set a config option (persisten=True)
m1.config("/proc/sys/net/ipv4/conf/all/forwarding", "0", True)
# run a shell command
devname = m2.get_devname("testiface")
m1.run("echo %s" % devname, timeout=30)
# prepare a module for execution
ping_mod = ctl.get_module("IcmpPing", addr=m2.get_ip("testiface", 0),
count=40, interval=0.2, limit_rate=95)
# run the module twice on machine one
ping_test = m1.run(ping_mod, timeout=30)
ping_test = m1.run(ping_mod, bg=True, timeout=30)
# make the controller wait
ctl.wait(5)
# interrupt the process
ping_test.intr()
The task is simply a script in python. You get exactly the same results
as if you use the XML task directly in the recipe, although you have FAR
less options in structuring your tests and customizing them exactly to
your needs.
Cheers,
-Radek
Radek Pazdera (3):
RecipeParse: Adding python attribute to tasks
ctl: Adding the task API for python
NetTestController: Adding support for python tasks
lnst/Controller/NetTestController.py | 65 +++++---
lnst/Controller/RecipeParse.py | 4 +
lnst/Controller/Task.py | 285 +++++++++++++++++++++++++++++++++++
3 files changed, 336 insertions(+), 18 deletions(-)
create mode 100644 lnst/Controller/Task.py
--
1.8.3.1
10 years, 8 months
[lnst] NetTestController: Adding support for python tasks
by Jiří Pírko
commit 66a0674bfd36ae6f330890d6d4772fc1abaaaf6f
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Wed Aug 7 15:52:49 2013 +0200
NetTestController: Adding support for python tasks
This commit contains the changes that were necessary to support python
tasks by the controller.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/NetTestController.py | 65 ++++++++++++++++++++++++---------
1 files changed, 47 insertions(+), 18 deletions(-)
---
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index ca41ca2..27d2368 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -17,6 +17,7 @@ import os
import re
import pickle
import tempfile
+import imp
from time import sleep
from xmlrpclib import Binary
from pprint import pprint, pformat
@@ -33,6 +34,8 @@ from lnst.Controller.Machine import Machine, MachineError
from lnst.Common.ConnectionHandler import send_data, recv_data
from lnst.Common.ConnectionHandler import ConnectionHandler
from lnst.Common.Config import lnst_config
+from lnst.Common.RecipePath import RecipePath
+import lnst.Controller.Task as Task
class NetTestError(Exception):
pass
@@ -240,9 +243,19 @@ class NetTestController:
for task_data in self._recipe["tasks"]:
task = {}
+ task["quit_on_fail"] = False
if "quit_on_fail" in task_data:
task["quit_on_fail"] = bool_it(task_data["quit_on_fail"])
+ if "python" in task_data:
+ root = RecipePath(None, self._recipe_path).get_root()
+ path = "%s/%s" % (root, task_data["python"])
+
+ task["python"] = path
+ if not os.path.isfile(path):
+ msg = "Task file '%s' not found." % path
+ raise RecipeError(msg, task_data)
+
task["commands"] = []
for cmd_data in task_data["commands"]:
cmd = {"type": cmd_data["type"]}
@@ -422,7 +435,11 @@ class NetTestController:
for task in self._tasks:
try:
self._res_serializer.add_task()
- res = self._run_task(task)
+ if "python" in task:
+ res = self._run_python_task(task)
+ else:
+ res = self._run_task(task)
+
except CommandException as exc:
logging.debug(exc)
overall_res = False
@@ -439,30 +456,26 @@ class NetTestController:
return overall_res
+ def _run_python_task(self, task):
+ # Initialize the API handle
+ Task.ctl = Task.ControllerAPI(self, self._machines)
+
+ name = os.path.basename(task["python"]).split(".")[0]
+ module = imp.load_source(name, task["python"])
+ return module.ctl._result
+
def _run_task(self, task):
seq_passed = True
for command in task["commands"]:
- logging.info("Executing command: [%s]", str_command(command))
-
- try:
- cmd_res = self._run_command(command)
- except Exception as exc:
- cmd_res = {"passed": False, "err_msg": "Exception raised."}
- raise exc
- finally:
- if self._res_serializer:
- self._res_serializer.add_cmd_result(command, cmd_res)
- logging.debug("Result: %s", str(cmd_res))
- if "res_data" in cmd_res:
- res_data = pformat(cmd_res["res_data"])
- logging.info("Result data: %s", (res_data))
+ cmd_res = self._run_command(command)
if not cmd_res["passed"]:
- logging.error("Command failed: [%s], Error message: \"%s\"",
- str_command(command), cmd_res["err_msg"])
seq_passed = False
+
return seq_passed
def _run_command(self, command):
+ logging.info("Executing command: [%s]", str_command(command))
+
if "desc" in command:
logging.info("Cmd description: %s", desc)
@@ -474,7 +487,23 @@ class NetTestController:
machine_id = command["machine"]
machine = self._machines[machine_id]
- cmd_res = machine.run_command(command)
+ try:
+ cmd_res = machine.run_command(command)
+ except Exception as exc:
+ cmd_res = {"passed": False, "err_msg": "Exception raised."}
+ raise exc
+ finally:
+ if self._res_serializer:
+ self._res_serializer.add_cmd_result(command, cmd_res)
+
+ logging.debug("Result: %s", str(cmd_res))
+ if "res_data" in cmd_res:
+ res_data = pformat(cmd_res["res_data"])
+ logging.info("Result data: %s", (res_data))
+ if not cmd_res["passed"]:
+ logging.error("Command failed: [%s], Error message: \"%s\"",
+ str_command(command), cmd_res["err_msg"])
+
return cmd_res
def _start_packet_capture(self):
10 years, 8 months
[lnst] ctl: Adding the task API for python
by Jiří Pírko
commit 0b7db8357f1c5f5e8542adb3b5e2ebe2bcd17531
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Wed Aug 7 15:52:48 2013 +0200
ctl: Adding the task API for python
This commit contains the task API for python. This will allow using
python for wrinting LNST task instad the very limited XML.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/Task.py | 285 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 285 insertions(+), 0 deletions(-)
---
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
new file mode 100644
index 0000000..d026e7d
--- /dev/null
+++ b/lnst/Controller/Task.py
@@ -0,0 +1,285 @@
+"""
+This module contains the API for python tasks.
+
+Copyright 2013 Red Hat, Inc.
+Licensed under the GNU General Public License, version 2 as
+published by the Free Software Foundation; see COPYING for details.
+"""
+
+__author__ = """
+rpazdera(a)redhat.com (Radek Pazdera)
+"""
+
+# The handle to be imported from each task
+ctl = None
+
+class TaskError(Exception): pass
+
+class ControllerAPI(object):
+ """ An API class representing the controller. """
+
+ def __init__(self, ctl, machines):
+ self._ctl = ctl
+ self._machines = machines
+ self._result = True
+
+ def _run_command(self, command):
+ """
+ An internal wrapper that allows keeping track of the
+ results of the commands within the task.
+
+ Please, don't use this.
+ """
+ res = self._ctl._run_command(command)
+ self._result = self._result and res["passed"]
+ return res
+
+ def get_machine(self, machine_id):
+ """
+ Get an API handle for the machine from the recipe spec with
+ a specific id.
+
+ :param machine_id: id of the machine as defined in the recipe
+ :type machine_id: string
+
+ :return: The machine handle.
+ :rtype: MachineAPI
+
+ :raises TaskError: If there is no machine with such id.
+ """
+ if machine_id not in self._machines:
+ raise TaskError("Machine '%s' not found." % machine_id)
+
+ machine = self._machines[machine_id]
+ return MachineAPI(self, machine_id, machine)
+
+ def get_module(self, name, **kwargs):
+ """
+ Initialize a module to be run on a machine.
+
+ :param name: name of the module
+ :type name: string
+
+ :return: The module handle.
+ :rtype: ModuleAPI
+ """
+ return ModuleAPI(name, kwargs)
+
+ def wait(self, seconds):
+ """
+ The controller will wait for a specific amount of seconds.
+
+ :param seconds: how long
+ :type seconds: float
+
+ :return: Command result (always passes).
+ :rtype: dict
+ """
+ cmd = {"type": "ctl_wait", "seconds": int(seconds)}
+ return self._ctl._run_command(cmd)
+
+class MachineAPI(object):
+ """ An API class representing a machine. """
+
+ def __init__(self, ctl, machine_id, machine):
+ self._ctl = ctl
+ self._id = machine_id
+ self._m = machine
+
+ self._bg_id_seq = 0
+
+ def config(self, option, value, persistent=False):
+ """
+ Configure an option in /sys or /proc on the machine.
+
+ :param option: A path within /sys or /proc.
+ :type option: string
+ :param value: Value to be set.
+ :type value: string
+ :param persistent: A flag.
+ :type persistent: bool
+
+ :return: Command result.
+ :rtype: dict
+ """
+ cmd = {"machine": str(self._id), "type": "config"}
+ cmd["options"] = [{"name": option, "value": value}]
+ cmd["persistent"] = persistent
+
+ return self._ctl._run_command(cmd)
+
+ def run(self, what, **kwargs):
+ """
+ Configure an option in /sys or /proc on the machine.
+
+ :param what: What should be run on the machine.
+ :type what: str or ModuleAPI
+
+ :param bg: Run in background flag.
+ :type bg: bool
+ :param expect: "pass" or "fail".
+ :type expect: string
+ :param timeout: A time limit in seconds.
+ :type timeout: int
+ :param tool: Run from a tool (the same as 'from' in XML).
+ :type tool: string
+
+ :return: A handle for process.
+ :rtype: ProcessAPI
+ """
+ cmd = {"machine": str(self._id)}
+ bg_id = None
+
+ for arg, argval in kwargs.iteritems():
+ if arg == "bg" and argval == True:
+ self._bg_id_seq += 1
+ cmd["bg_id"] = bg_id = self._bg_id_seq
+ elif arg == "expect":
+ if argval not in ["pass", "fail"]:
+ msg = "Unrecognised value of the expect attribute (%s)." \
+ % argval
+ raise TaskError(msg)
+
+ cmd["expect"] = argval == "pass"
+ elif arg == "timeout":
+ try:
+ cmd["timeout"] = int(argval)
+ except ValueError:
+ msg = "Timeout must be integer, not '%s'." % argval
+ raise TaskError(msg)
+ elif arg == "tool":
+ if type(what) == str:
+ cmd["from"] = argval
+ else:
+ msg = "Argument 'tool' not valid when running modules."
+ raise TaskError(msg)
+ else:
+ msg = "Argument '%s' not recognised by the run() method." % arg
+ raise TaskError(msg)
+
+ if type(what) == ModuleAPI:
+ cmd["type"] = "test"
+ cmd["module"] = what._name
+ cmd["options"] = what._opts
+ elif type(what) == str:
+ cmd["type"] = "exec"
+ cmd["command"] = what
+ else:
+ raise TaskError("Unable to run '%s'." % str(what))
+
+ cmd_res = self._ctl._run_command(cmd)
+ return ProcessAPI(self._ctl, self._id, cmd_res, bg_id)
+
+ def get_devname(self, interface_id):
+ """
+ Returns devname of the interface.
+
+ :param interface_id: which interface
+ :type interface_id: string
+
+ :return: Device name (e.g., eth0).
+ :rtype: str
+ """
+ iface = self._m.get_interface(interface_id)
+ return iface.get_devname()
+
+ def get_hwaddr(self, interface_id):
+ """
+ Returns hwaddr of the interface.
+
+ :param interface_id: which interface
+ :type interface_id: string
+
+ :return: HW address (e.g., 00:11:22:33:44:55:FF).
+ :rtype: str
+ """
+ iface = self._m.get_interface(interface_id)
+ return iface.get_hwaddr()
+
+ def get_ip(self, interface_id, addr_number=0):
+ """
+ Returns an IP address of the interface.
+
+ :param interface_id: which interface
+ :type interface_id: string
+
+ :param interface_id: which address
+ :type interface_id: int
+
+ :return: IP address (e.g., 192.168.1.10).
+ :rtype: str
+ """
+ iface = self._m.get_interface(interface_id)
+ return iface.get_address(addr_number)
+
+class ModuleAPI(object):
+ """ An API class representing a module. """
+
+ def __init__(self, module_name, options):
+ self._name = module_name
+
+ self._opts = {}
+ for opt, val in options.iteritems():
+ self._opts[opt] = []
+ if type(val) == list:
+ for v in val:
+ self._opts[opt].append({"value": v})
+ else:
+ self._opts[opt].append({"value": val})
+
+class ProcessAPI(object):
+ """ An API class representing either a running or finished process. """
+
+ def __init__(self, ctl, m_id, cmd_res, bg_id):
+ self._ctl = ctl
+ self._machine = m_id
+ self._cmd_res = cmd_res
+ self._bg_id = bg_id
+
+ def passed(self):
+ """
+ Returns a boolean result of the process.
+
+ :return: True if the command passed.
+ :rtype: bool
+ """
+ return self.cmd_res["passed"]
+
+ def get_result(self):
+ """
+ Returns the whole comand result.
+
+ :return: Command result data.
+ :rtype: dict
+ """
+ return self.cmd_res
+
+ def wait(self):
+ """ Blocking wait until the command returns. """
+ if self._bg_id:
+ cmd = {"machine": self._machine,
+ "type": "wait",
+ "proc_id": self._bg_id}
+ self._res = self._ctl._run_command(cmd)
+
+ def intr(self):
+ """ Interrupt the command. """
+ if self._bg_id:
+ cmd = {"machine": self._machine,
+ "type": "intr",
+ "proc_id": self._bg_id}
+ self._res = self._ctl._run_command(cmd)
+
+ def kill(self):
+ """
+ Kill the command.
+
+ In this case, the command results are disposed. A killed
+ command will always be shown as passed. If you would like
+ to keep the results, use 'intr' instead.
+ """
+ if self._bg_id:
+ cmd = {"machine": self._machine,
+ "type": "kill",
+ "proc_id": self._bg_id}
+ self._res = self._ctl._run_command(cmd)
10 years, 8 months
[lnst] RecipeParse: Adding python attribute to tasks
by Jiří Pírko
commit 94c538bc91683a66bc4682b9de17811d00906029
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Wed Aug 7 15:52:47 2013 +0200
RecipeParse: Adding python attribute to tasks
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/RecipeParse.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/lnst/Controller/RecipeParse.py b/lnst/Controller/RecipeParse.py
index 6042dfe..8e0aed7 100644
--- a/lnst/Controller/RecipeParse.py
+++ b/lnst/Controller/RecipeParse.py
@@ -271,6 +271,10 @@ class TaskParse(LnstParser):
if self._has_attribute(node, "label"):
task["label"] = self._get_attribute(node, "label")
+ if self._has_attribute(node, "python"):
+ task["python"] = self._get_attribute(node, "python")
+ return task
+
scheme = {"config": self._config,
"run": self._run,
"ctl_wait": self._ctl_wait,
10 years, 8 months