NAME

App::FuguVM::Console - drive the serial console of a guest

SYNOPSIS

use App::FuguVM::Console;

my $console = App::FuguVM::Console->new(
    host => '127.0.0.1',
    port => $console_port,
);

$console->run_install({
    root_password => $password,
    proxy_url     => $proxy->guest_url,
}) or die "installation failed\n";

$console->run_script('reboot.exp');

DESCRIPTION

The console answers no protocol, so an expect(1) script types at it. The module runs the OpenBSD installer that way, and it runs any other script the operator names: fuguvm expect is that second verb. The scripts ship under share/fuguvm/expect, and Fugu::File resolves them against the install root.

The run is a passthrough: the child writes straight to the terminal of the caller. An installation writes for tens of minutes, and an operator who waits needs to see the progress while it happens.

METHODS

new

App::FuguVM::Console->new(host => ..., port => ...)

The host and port name the serial console. Each script reads its timeout from FUGUVM_TIMEOUT in the environment and carries its own default.

script_path

App::FuguVM::Console->script_path($name)

Return the path of a shipped script, or undef. The method also works on the class: App::FuguVM::DiskCache hashes the installer script into its cache key, so it must resolve the script the same way run_install does.

run_install

$console->run_install(\%config)

Drive a complete installation. The configuration gives the root password and the proxy URL that the guest fetches its sets through.

run_script

$console->run_script($script, @args)

Run one script against this console. The argument is a path, or the name of a shipped script.

SEE ALSO

expect(1), Fugu::File, Fugu::Process, App::FuguVM::Guest

AUTHOR

Dick Olsson <hi@senzilla.io>