Documentation ¶
Index ¶
- Constants
- type BaseRunner
- type IBaseRunner
- type LocalRunner
- type Runner
- type RunnerHostResult
- type RunnerResponse
- type RunnerResponseGroup
- type RunnerResponseModule
- type RunnerStdResult
- type SSHRunner
- func (shr *SSHRunner) AddHost(fqdn string) *SSHRunner
- func (shr *SSHRunner) SetPermanentMode(root string) *SSHRunner
- func (shr *SSHRunner) SetRSAKeys(rsapath string) *SSHRunner
- func (shr *SSHRunner) SetRemoteUsername(username string) *SSHRunner
- func (shr *SSHRunner) SetSSHHostVerification(hvf bool) *SSHRunner
- func (shr *SSHRunner) SetSSHPort(port int) *SSHRunner
- func (shr *SSHRunner) SetStaticDataRoot(root string) *SSHRunner
- func (shr *SSHRunner) SetUserRSAKeys(username string) *SSHRunner
- type SSHSession
- type SshShell
- func (ns *SshShell) Connect() *SshShell
- func (ns *SshShell) Disconnect() *SshShell
- func (ns *SshShell) GetFQDN() string
- func (ns *SshShell) NewSession() *SSHSession
- func (ns *SshShell) SetFQDN(fqdn string) *SshShell
- func (ns *SshShell) SetHostVerification(hv bool) *SshShell
- func (ns *SshShell) SetPort(port int) *SshShell
- func (ns *SshShell) SetRSAPrivKey(name string) *SshShell
- func (ns *SshShell) SetRSAPubKey(name string) *SshShell
- func (ns *SshShell) SetRemotePassword(password string) *SshShell
- func (ns *SshShell) SetRemoteUsername(username string) *SshShell
Constants ¶
const ( ERR_OK = 0 ERR_FAILED = 1 ERR_TIMEOUT = 2 // Prepared, but unprocessed ERR_INIT = 255 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseRunner ¶
type BaseRunner struct {
// contains filtered or unexported fields
}
func (*BaseRunner) Errcode ¶
func (br *BaseRunner) Errcode() int
Errcode returns an error code of the runner
func (*BaseRunner) Response ¶
func (br *BaseRunner) Response() *RunnerResponse
Response returns a map of string/any structure for further processing
func (*BaseRunner) Run ¶
func (br *BaseRunner) Run(state *nanocms_state.Nanostate) bool
Run the compiled and loaded nanostate
type IBaseRunner ¶
type IBaseRunner interface {
// contains filtered or unexported methods
}
type LocalRunner ¶
type LocalRunner struct {
BaseRunner
}
func NewLocalRunner ¶
func NewLocalRunner() *LocalRunner
type Runner ¶
type Runner interface { // Run the compiled and loaded nanostate Run(state *nanocms_state.Nanostate) error // Response returns a map of string/any structure for further processing Response() map[string]interface{} // Errcode returns an error code of the runner Errcode() int }
Interface for the runner
type RunnerHostResult ¶
type RunnerHostResult struct { Host string Response map[string]RunnerStdResult }
type RunnerResponse ¶
type RunnerResponse struct { Id string Description string Groups map[string]RunnerResponseGroup }
func (*RunnerResponse) JSON ¶
func (rr *RunnerResponse) JSON() string
JSON output of the response structure
func (*RunnerResponse) PrettyJSON ¶
func (rr *RunnerResponse) PrettyJSON() string
JSON output of the response structure
func (*RunnerResponse) Serialise ¶
func (rr *RunnerResponse) Serialise() map[string]interface{}
Serialise to a map/interface object
type RunnerResponseGroup ¶
type RunnerResponseGroup struct { Errcode int Errmsg string Response []RunnerResponseModule }
type RunnerResponseModule ¶
type RunnerResponseModule struct { Module string Errcode int Errmsg string Response []RunnerHostResult }
type RunnerStdResult ¶
type SSHRunner ¶
type SSHRunner struct { BaseRunner // contains filtered or unexported fields }
func NewSSHRunner ¶
func NewSSHRunner() *SSHRunner
func (*SSHRunner) SetPermanentMode ¶
SetPermanentMode takes a root path where it will will create the following structure:
$ROOT/bin /etc /modules
In "bin" directory local runners are stored; "etc" contains possible configurations, if any; "modules" will stockpile on demand remote modules, if they are downloaded.
func (*SSHRunner) SetRSAKeys ¶
SetRSAKeys will set a root directory to the RSA keypair and "known_hosts" database file. If an empty string is provided, "$HOME/.ssh" is used instead.
func (*SSHRunner) SetRemoteUsername ¶
SetRemoteUserame sets remote username.
func (*SSHRunner) SetSSHHostVerification ¶
SetSSHHostVerification enables (true, default) or disables (false) the remote host verification, based on the "known_hosts" database.
func (*SSHRunner) SetSSHPort ¶
SetSSHPort sets an alternative SSH port if needed. Default is 22.
func (*SSHRunner) SetStaticDataRoot ¶
SetStaticDataRoot is a directory where runners and other client-related data is located. Static directory should have a specified structure. For example, for runners it should be "runners/<ARCH>/", e.g. "runners/x86_64/", "runners/arm/" etc.
func (*SSHRunner) SetUserRSAKeys ¶
SetUserRSAKeys will set a root directory to the RSA keypair and "known_hosts" database file based on "$HOME/.ssh" from the given username. If an empty string passed, current user is chosen.
type SSHSession ¶
func NewSSHSession ¶
func NewSSHSession(ctx *ssh.Client) *SSHSession
type SshShell ¶
type SshShell struct {
// contains filtered or unexported fields
}
func NewSshShell ¶
Constructor. Needs to be given a location of SSH keys, including "known_hosts". As an example: "/home/someuser/.ssh".
func (*SshShell) Disconnect ¶
Disconnect closes the SSH connection
func (*SshShell) NewSession ¶
func (ns *SshShell) NewSession() *SSHSession
func (*SshShell) SetHostVerification ¶
SetHostVerification to true or false on SSH connection. Default is set to True.
func (*SshShell) SetPort ¶
SetPort the opened SSH port on the node that is going to be staged. Default is a standard 22.
func (*SshShell) SetRSAPrivKey ¶
SetRSAPrivKey sets a path to the private RSA key for the SSH connection.
func (*SshShell) SetRSAPubKey ¶
SetRSAPubKey sets a path to the public RSA key for the SSH connection. This key should be deployed to the target node.
func (*SshShell) SetRemotePassword ¶
SetRemotePaassword sets remote password for the username. If password is not set, keypair authentication is used instead.
func (*SshShell) SetRemoteUsername ¶
SetRemoteUsername sets remote username. Default is the current username.