console

package
v0.35.0-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PromptExpression = `(\$ |\# )`
	CRLF             = "\r\n"
	UTFPosEscape     = "\u001b\\[[0-9]+;[0-9]+H"
)

Variables

This section is empty.

Functions

func ExpectBatch

func ExpectBatch(vmi *v1.VirtualMachineInstance, expected []expect.Batcher, timeout time.Duration) error

ExpectBatch runs the batch from `expected` connecting to the `vmi` console and wait `timeout` for the batch to return. NOTE: there is a safer version that validates sended commands `SafeExpectBatch` refer to it about limitations.

func ExpectBatchWithValidatedSend

func ExpectBatchWithValidatedSend(expecter expect.Expecter, batch []expect.Batcher, timeout time.Duration) ([]expect.BatchRes, error)

ExpectBatchWithValidatedSend adds the expect.BSnd command to the exect.BExp expression. It is done to make sure the match was found in the result of the expect.BSnd command and not in a leftover that wasn't removed from the buffer. NOTE: the method contains the following limitations:

  • Use of `BatchSwitchCase`
  • Multiline commands
  • No more than one sequential send or receive

func NetBootExpecter

func NetBootExpecter(vmi *v1.VirtualMachineInstance) (expect.Expecter, error)

NetBootExpecter should be called on a VMI that has BIOS serial logging enabled It will parse the SeaBIOS output and succeed if it finds the string "iPXE"

func NewExpecter

func NewExpecter(virtCli kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance, timeout time.Duration, opts ...expect.Option) (expect.Expecter, <-chan error, error)

NewExpecter will connect to an already logged in VMI console and return the generated expecter it will wait `timeout` for the connection.

func RetValue

func RetValue(retcode string) string

func RunCommand

func RunCommand(vmi *v1.VirtualMachineInstance, command string, timeout time.Duration) error

RunCommand runs the command line from `command connecting to an already logged in console at vmi and wait `timeout` for command to return. NOTE: The safer version `ExpectBatchWithValidatedSend` is not used here since it does not support cases.

func SafeExpectBatch

func SafeExpectBatch(vmi *v1.VirtualMachineInstance, expected []expect.Batcher, wait int) error

SafeExpectBatch runs the batch from `expected` connecting to a VMI's console and wait `timeout` for the batch to return, it also check that the sended commands arrives to console checking. NOTE: This functions heritage limitations from `ExpectBatchWithValidatedSend` refer to it to check them.

func SecureBootExpecter

func SecureBootExpecter(vmi *v1.VirtualMachineInstance) (expect.Expecter, error)

SecureBootExpecter should be called on a VMI that has EFI enabled It will parse the kernel output (dmesg) and succeed if it finds that Secure boot is enabled

Types

type VMIExpecterFactory

type VMIExpecterFactory func(*v1.VirtualMachineInstance) (expect.Expecter, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL