otto

package module
v0.0.0-...-901012e Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

README

otto

Welcome to Otto, where things are Ottomatic beyond belief!

What is Otto?

Otto is a automatic toolkit for Linux and BSD systems. It allows you to easily run scripts against many servers from a cental interface. At a fundamental level it aims to strike a balance between the scripting power of Ansible with the centralized configuration of Puppet.

Who should use it?

Otto works great for power users, at-home-sysadmins, and developers with small-to-medium sized clusters.

Even if you only have two Linux machines, Otto can provide value in helping save you time when maintaining those systems.

How can I learn more?

Take a look at our documentation!

Documentation

Overview

Package otto an automation toolkit for Unix-like computers.

This package contains the common interfaces and methods shared by the Otto client and Otto server.

Index

Constants

View Source
const (
	MessageTypeKeepalive uint32 = iota + 1
	MessageTypeHeartbeatRequest
	MessageTypeHeartbeatResponse
	MessageTypeTriggerAction
	MessageTypeCancelAction
	MessageTypeActionOutput
	MessageTypeActionResult
	MessageTypeGeneralFailure
)

Message types

View Source
const (
	ActionRunScript uint32 = iota + 1
	ActionReloadConfig
	ActionUploadFile
	ActionUploadFileAndExit
	ActionExit
	ActionReboot
	ActionShutdown
	ActionUpdatePSK
)

Actions

View Source
const ProtocolVersion = uint32(2)

ProtocolVersion the version of the otto protocol

Variables

This section is empty.

Functions

func DecodeMessage

func DecodeMessage(messageType uint32, data []byte) (interface{}, error)

DecodeMessage try to decode the given message. The returned object should match the message struct for the message type.

func EncodeMessage

func EncodeMessage(messageType uint32, message interface{}) ([]byte, error)

EncodeMessage try to encode the given message

func ReadMessage

func ReadMessage(r io.Reader, psk string) (uint32, interface{}, error)

ReadMessage try to read a message from the given reader. Returns the message type, the message data, or an error

func WriteMessage

func WriteMessage(messageType uint32, message interface{}, w io.Writer, psk string) error

WriteMessage try to write a message to the given writer.

Types

type File

type File struct {
	Path  string `json:"path"`
	Owner RunAs  `json:"owner"`
	Mode  uint32 `json:"mode"`
	Data  []byte `json:"data"`
}

File Describes a file

type MessageActionOutput

type MessageActionOutput struct {
	Stdout []byte `json:"stdout"`
	Stderr []byte `json:"stderr"`
}

MessageActionOutput describes output from an action

type MessageActionResult

type MessageActionResult struct {
	ScriptResult  ScriptResult `json:"script_result"`
	Error         error        `json:"error"`
	File          File         `json:"file"`
	ClientVersion string       `json:"client_version"`
}

MessageActionResult describes the result of a triggered action

type MessageCancelAction

type MessageCancelAction struct{}

MessageCancelAction describes a request to cancel an action

type MessageGeneralFailure

type MessageGeneralFailure struct {
	Error error `json:"error"`
}

MessageGeneralFailure describes a general failure

type MessageHeartbeatRequest

type MessageHeartbeatRequest struct {
	ServerVersion string `json:"server_version"`
}

MessageHeartbeatRequest describes a heartbeat request

type MessageHeartbeatResponse

type MessageHeartbeatResponse struct {
	ClientVersion string            `json:"client_version"`
	Properties    map[string]string `json:"properties"`
}

MessageHeartbeatResponse describes a heartbeat response

type MessageTriggerAction

type MessageTriggerAction struct {
	Action uint32 `json:"action"`
	Script Script `json:"script"`
	File   File   `json:"file"`
	NewPSK string `json:"new_psk"`
}

MessageTriggerAction describes an action trigger

type RegisterRequest

type RegisterRequest struct {
	Key        string                    `json:"key"`
	Port       uint32                    `json:"port"`
	Properties RegisterRequestProperties `json:"properties"`
}

RegisterRequest describes a register request

type RegisterRequestProperties

type RegisterRequestProperties struct {
	Hostname            string `json:"hostname"`
	KernelName          string `json:"kernel_name"`
	KernelVersion       string `json:"kernel_version"`
	DistributionName    string `json:"distribution_name"`
	DistributionVersion string `json:"distribution_version"`
}

RegisterRequestProperties describes properties for a register request

type RegisterResponse

type RegisterResponse struct {
	PSK     string   `json:"psk"`
	Scripts []Script `json:"scripts,omitempty"`
}

RegisterResponse describes the response to a register request

type RunAs

type RunAs struct {
	Inherit bool   `json:"inherit"`
	UID     uint32 `json:"uid"`
	GID     uint32 `json:"gid"`
}

RunAs describes the user to run a script as

type Script

type Script struct {
	Name             string            `json:"name"`
	RunAs            RunAs             `json:"run_as"`
	Environment      map[string]string `json:"environment"`
	WorkingDirectory string            `json:"working_directory"`
	Executable       string            `json:"executable"`
	Files            []File            `json:"files"`
	Data             []byte            `json:"data"`
}

Script describes a script

type ScriptResult

type ScriptResult struct {
	Success   bool          `json:"success"`
	ExecError string        `json:"exec_error"`
	Code      int           `json:"code"`
	Stdout    string        `json:"stdout"`
	Stderr    string        `json:"stderr"`
	Elapsed   time.Duration `json:"elapsed"`
}

ScriptResult describes the result of the script

func (ScriptResult) String

func (sr ScriptResult) String() string

Directories

Path Synopsis
cmd
environ
Package environ is a custom environment variable utilities for otto
Package environ is a custom environment variable utilities for otto

Jump to

Keyboard shortcuts

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