command

package
v0.0.0-...-1e2d67d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2019 License: BSD-2-Clause Imports: 23 Imported by: 0

Documentation

Overview

Package command for archive Archive compresses command output into a zip file

Package command for HashiCorp's Consul https://consul.io/ VaultCommand executes commands with the consul command line internally and stores the output in plain text files

Package command for info [WIP] Info executes commands and displays a mini dashboard

Package command for HashiCorp's Nomad https://nomadproject.io/ VaultCommand executes commands with the nomad command line internally and stores the output in plain text files

Package command for system System executes operating system commands and stores output

Package command for upload Upload puts the archive file into an S3 bucket

Package command for HashiCorp's Vault https://vaultproject.io/ VaultCommand executes commands with the vault command line internally and stores the output in plain text files

Index

Constants

View Source
const (
	// CheckpointURLBase is the URL base for CheckPoint API
	CheckpointURLBase string = "https://checkpoint-api.hashicorp.com"

	// ReleaseURLBase is the URL base for the HashiCorp releases website
	ReleaseURLBase string = "https://releases.hashicorp.com"

	// VaultReleaseURLBase is the URL base for the Vault releases page
	VaultReleaseURLBase string = "https://releases.hashicorp.com/vault/"

	// Consul binary name
	Consul string = "consul"

	// ConsulTemplate binary name
	ConsulTemplate string = "consul-template"

	// EnvConsul binary name
	EnvConsul string = "envconsul"

	// Nomad binary name
	Nomad string = "nomad"

	// Packer binary name
	Packer string = "packer"

	// Sentinel binary name
	Sentinel string = "sentinel"

	// Terraform binary name
	Terraform string = "terraform"

	// Vagrant binary name
	Vagrant string = "vagrant"

	// Vault binary name
	Vault string = "vault"
)
View Source
const (
	// Darwin OS
	Darwin string = "darwin"
	// FreeBSD OS
	FreeBSD string = "freebsd"
	// Linux OS
	Linux string = "linux"
	// NetBSD OS
	NetBSD string = "netbsd"
	// OpenBSD OS
	OpenBSD string = "openbsd"
	// Solaris OS
	Solaris string = "solaris"
	// Windows OS
	Windows string = "windows"
)

Variables

This section is empty.

Functions

func ActiveLocalVersion

func ActiveLocalVersion(binary string) (string, error)

ActiveLocalVersion tries to locate binary tools in the system path and get their version using OS calls 'consul version' has a slightly different output style from the others, and must be handled differently

func CheckHashiVersion

func CheckHashiVersion(name string) string

CheckHashiVersion attempts to locate HashiCorp runtime tools in and get their versions - Consul has slightly different version output style so it must be handled differently

func CheckProc

func CheckProc(name string) (string, error)

CheckProc checks for a running process by name with pgrep or ps and returns its PID

func Dump

func Dump(dumpType string, outfile string, cmdName string, args ...string) int

Dump takes a type, output filename and command, which it then executes while also writing stdout + stderr to a file named for the command Inspired by debug-ninja! (https://github.com/fprimex/debug-ninja)

func FileExist

func FileExist(fileName string) bool

FileExist checks for a file's existence

func GetHostName

func GetHostName() (string, error)

GetHostName gets the current system's network hostname

func HTTPCmdCheck

func HTTPCmdCheck() string

HTTPCmdCheck checks for curl or wget and use what is present

func ZipIt

func ZipIt(target string)

ZipIt archives rover results into a zip file suitable for tubing

Types

type ArchiveCommand

type ArchiveCommand struct {
	ArchivePath string
	HostName    string
	OS          string
	KeepData    bool
	TargetFile  string
	UI          cli.Ui
}

ArchiveCommand describes common zip file fields

func (*ArchiveCommand) Help

func (c *ArchiveCommand) Help() string

Help output

func (*ArchiveCommand) Run

func (c *ArchiveCommand) Run(args []string) int

Run command

func (*ArchiveCommand) Synopsis

func (c *ArchiveCommand) Synopsis() string

Synopsis output

type ConsulCommand

type ConsulCommand struct {
	ConsulPID      string
	HostName       string
	HTTPCommand    string
	HTTPTokenValue string
	OS             string
	OutputPath     string
	UI             cli.Ui
}

ConsulCommand describes Consul related fields

func (*ConsulCommand) Help

func (c *ConsulCommand) Help() string

Help output

func (*ConsulCommand) Run

func (c *ConsulCommand) Run(_ []string) int

Run consul commands

func (*ConsulCommand) Synopsis

func (c *ConsulCommand) Synopsis() string

Synopsis output

type InfoCommand

type InfoCommand struct {
	ConsulVersion string
	HostName      string
	NomadVersion  string
	OS            string
	Uptime        string
	UI            cli.Ui
	VaultVersion  string
}

InfoCommand describes info dashboard related fields

func (*InfoCommand) Help

func (c *InfoCommand) Help() string

Help output

func (*InfoCommand) Run

func (c *InfoCommand) Run(_ []string) int

Run command

func (*InfoCommand) Synopsis

func (c *InfoCommand) Synopsis() string

Synopsis output

type Internal

type Internal struct {
	ConsulVersion string
	HostName      string
	NomadVersion  string
	OS            string
	LogFile       string
	TargetFile    string
	VaultVersion  string
}

Internal describes fields which support the internal commands

type NomadCommand

type NomadCommand struct {
	HostName string
	OS       string
	UI       cli.Ui
	NomadPID string
}

NomadCommand describes Nomad related fields

func (*NomadCommand) Help

func (c *NomadCommand) Help() string

Help output

func (*NomadCommand) Run

func (c *NomadCommand) Run(_ []string) int

Run nomad commands

func (*NomadCommand) Synopsis

func (c *NomadCommand) Synopsis() string

Synopsis output

type SystemCommand

type SystemCommand struct {
	Arch         string
	HostName     string
	OS           string
	ReleaseFiles []string
	UI           cli.Ui
	LogFile      string
}

SystemCommand describes system related fields

func (*SystemCommand) Help

func (c *SystemCommand) Help() string

Help output

func (*SystemCommand) Run

func (c *SystemCommand) Run(_ []string) int

Run the command

func (*SystemCommand) Synopsis

func (c *SystemCommand) Synopsis() string

Synopsis for command

type UploadCommand

type UploadCommand struct {
	AccessKey   string
	ArchiveFile string
	Bucket      string
	HostName    string
	OS          string
	Prefix      string
	Region      string
	SecretKey   string
	Token       string
	UI          cli.Ui
}

UploadCommand describes upload related fields

func (*UploadCommand) Help

func (c *UploadCommand) Help() string

Help output

func (*UploadCommand) Run

func (c *UploadCommand) Run(args []string) int

Run command

func (*UploadCommand) Synopsis

func (c *UploadCommand) Synopsis() string

Synopsis output

type VaultCommand

type VaultCommand struct {
	HostName        string
	OS              string
	UI              cli.Ui
	VaultPID        string
	VaultTokenValue string
	VaultVersion    string
}

VaultCommand describes Vault related fields

func (*VaultCommand) Help

func (c *VaultCommand) Help() string

Help output

func (*VaultCommand) Run

func (c *VaultCommand) Run(_ []string) int

Run vault commands

func (*VaultCommand) Synopsis

func (c *VaultCommand) Synopsis() string

Synopsis output

Jump to

Keyboard shortcuts

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