# autoserv_console.srv - gives you an interactive interpreter within an autoserv
# control file.  If you pass "-m hostname", a RemoteHost will be available under
# the variable "host".

# 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)

if machines:
    host = hosts.create_host(machines[0])

try:
    import IPython
    ipshell = IPython.Shell.IPShellEmbed(argv=[])
    ipshell()
except ImportError:
    import code
    code.interact("Autoserv console", raw_input, locals())
