Slightly updated/reformatted interactive console control files
From: Steven Howard <showard@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@955 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/samples/autotest_console.control b/client/samples/autotest_console.control
new file mode 100644
index 0000000..3825323
--- /dev/null
+++ b/client/samples/autotest_console.control
@@ -0,0 +1,16 @@
+# autotest_console.control - gives you an interactive interpreter within an
+# autotest control file.
+
+# If you install IPython (http://ipython.scipy.org/, Ubuntu package "ipython"),
+# you'll get a snazzy IPython console with readline and completion and all that.
+# Otherwise you'll get a simple console without any of that.
+
+# -Steve Howard (showard@google.com)
+
+try:
+ import IPython
+ ipshell = IPython.Shell.IPShellEmbed(argv=[])
+ ipshell()
+except ImportError:
+ import code
+ code.interact('Autotest console', raw_input, local_env)
diff --git a/server/samples/autoserv_console.srv b/server/samples/autoserv_console.srv
index 429a261..50bb62a 100755
--- a/server/samples/autoserv_console.srv
+++ b/server/samples/autoserv_console.srv
@@ -8,14 +8,13 @@
# -Steve Howard (showard@google.com)
-local_env = locals()
if machines:
- local_env['host'] = hosts.SSHHost(machines[0])
+ host = hosts.SSHHost(machines[0])
try:
- import IPython
- ipshell = IPython.Shell.IPShellEmbed(argv=[])
- ipshell()
+ import IPython
+ ipshell = IPython.Shell.IPShellEmbed(argv=[])
+ ipshell()
except ImportError:
- import code
- code.interact("Autoserv console", raw_input, local_env)
+ import code
+ code.interact("Autoserv console", raw_input, locals())