Documentation
¶
Index ¶
- Constants
- func ExpectBatch(vmi *v1.VirtualMachineInstance, expected []expect.Batcher, ...) error
- func ExpectBatchWithValidatedSend(expecter expect.Expecter, batch []expect.Batcher, timeout time.Duration) ([]expect.BatchRes, error)
- func NetBootExpecter(vmi *v1.VirtualMachineInstance) (expect.Expecter, error)
- func NewExpecter(virtCli kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance, ...) (expect.Expecter, <-chan error, error)
- func RetValue(retcode string) string
- func RunCommand(vmi *v1.VirtualMachineInstance, command string, timeout time.Duration) error
- func SafeExpectBatch(vmi *v1.VirtualMachineInstance, expected []expect.Batcher, wait int) error
- func SecureBootExpecter(vmi *v1.VirtualMachineInstance) (expect.Expecter, error)
- type VMIExpecterFactory
Constants ¶
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 RunCommand ¶
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 ¶
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)