Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check interface { // Name returns a user-friendly name for the check. This is meant to be // displayed in the UI to identify the check and should give the user an // idea of what it does. Name() string // Run runs the test. The return value tells if there was some error while // running the Check, not if the check has passed. // // A Check can assume that Run will be the first of its methods to be // called. Furthermore, if the error is not nil, it can assume the other // methods will not be called. Run() error // Passed checks if the test passed. Passed() bool // IlluminatingRemarks returns any remarks that may illuminate the user. // Because here we are not satisfied with simple feedback: we explain why // things are failing, how balena works, what the user could try to do to // solve the issue, and, when appropriate, help with transcendence. // // The first return value tells if the check actually has remarks. The // second one contains the remarks themselves, as a Markdown string. IlluminatingRemarks() (bool, string) // Details returns details about the execution of the check. This should // include all the low-level details a more advanced user could make good // use of. // // The first return value tells if the check actually has details. The // second one contains the details themselves, as a Markdown string. Details() (bool, string) }
Check defines how any of the tests we can run looks like.
type SSHCommand ¶
type SSHCommand struct { // The IP address of the device in which we'll run the SSH command. Must be // set before calling Run. IP string // The port to which we'll connect to run the SSH command. Must be set // before calling Run. Port string // The path to the file with the private key to use when authenticating with // the device. Must be set before calling Run. // // TODO: This is required for now, and must point to a valid file. This // doesn't prevent us from connecting to devices in development mode (which // don't need authentication by default), but is kinda odd. Should be // optional. SSHKeyFile string // Command contains the command to run over SSH. Must be set before calling // Run. Command string // ExitStatus contains the exit status code of the SSH command. This is set // by Run. ExitStatus int // StdOut contains the standard output of the SSH command. This is set by // Run. StdOut string // StdErr contains the standard error of the SSH command. This is set by // Run. StdErr string }
SSHCommand provides some boilerplate for implementing a Check that works by running a SSH command on the device.
func (*SSHCommand) Details ¶
func (c *SSHCommand) Details() (bool, string)
func (*SSHCommand) Run ¶
func (c *SSHCommand) Run() error
type SSHRunner ¶
type SSHRunner struct {
// contains filtered or unexported fields
}
SSHRunner allows to run SSH commands. Technically, it's a wrapper around Go's ssh.Client.
func NewSSHRunner ¶
NewSSHRunner creates a new SSHRunner. It will try to start an SSH session by user, on a server located at addr, and autheticating using the key at keyFile. Note that addr shall include the port, like "10.0.0.1:22222").
You must call Destroy() on the returned SSHRunner when it is no longer needed.
Click to show internal directories.
Click to hide internal directories.