config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2018 License: GPL-3.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OctopusCmd = &cobra.Command{
	Use:   "octopus [flags] [--host-groups|-h <HOST-GROUPS>] <COMMAND>",
	Short: "Octopus runs a command on multiple remote hosts in parallel",
	Long: `
-----------
  OCTOPUS
-----------

  Octopus is a simple pdsh-inspired commandline tool for running the same
  command on multiple remote hosts in parallel. Hosts are grouped together
  into "host groups" in a file which inspired by a "genders" file. The
  host groups file for Octopus is actually a Bash file with groups defined by
  variable definitions. This is so that the same file may be used easily by
	both Octopus and by user-made scripts and has the secondary benefit of
	supporting defining hosts by IP address as well as hostname.

  Under the hood, Octopus uses ssh connections, and some ssh arguments are
  reflected in Octopus's arguments. These arguments are marked in the help
  text with "(ssh)".

  WARNINGS:
    Octopus does not do verification of remote hosts (Equivalent to
    setting ssh option StrictHostKeyChecking=no) and does not add entries
    to the known hosts file.

  Config file:
    Octopus supports setting custom default values for flags in a config file.
  Any of Octopus's top-level, full-name flags can be set in the config.
  Octopus will search in order for the first 'config.yaml' file it finds in:
    (1) ./.octopus
    (2) $HOME/.octopus
    (3) /etc/octopus
  e.g., Simply writing "host-groups: all" into the config file will use the
  'all' host group for Octopus commands unless the user specifies a different
  set of host groups using '--host-groups|-h' on the commandline.
	`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		if viper.GetBool("verbose") {
			logger.Info.SetOutput(os.Stderr)
			logger.Info.Println("Running octopus in verbose mode")
			logger.Info.Println("Octopus version:", version.Version)
		}
	},
}

OctopusCmd is the top-level 'octopus' command.

Functions

func TrainOctopus

func TrainOctopus() (*octopus.Octopus, error)

TrainOctopus returns an octopus trained (configured) for the user's environment. This sanitizes values set in the config file and on the commandline to ensure the octopus is well-trained. This should be called by subcommands which wish to use an octopus, and it should *not* be called by subcommands which will not use an octopus since octopus-specific inputs are validated to be present in this function. If a required input for an octopus action is not present, this function will print CLI usage information and exit the program with a failure code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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