config

package
v0.0.0-...-288f078 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0, Apache-2.0, CC-BY-SA-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CheckCommand checkCommand
View Source
var DefaultYAML []byte
View Source
var DumpCommand dumpCommand
View Source
var DumpDefaultsCommand defaultsCommand
View Source
var ErrNoClustersDefined = errors.New("config does not define any clusters")

Functions

func ExportJSON

func ExportJSON(w io.Writer, cluster *arvados.Cluster) error

ExportJSON writes a JSON object with the safe (non-secret) portions of the cluster config to w.

func LoadSSHKey

func LoadSSHKey(confvalue string) (ssh.Signer, error)

Load an SSH private key from the given confvalue, which is either the literal key or an absolute path to a file containing the key.

Types

type Loader

type Loader struct {
	Stdin          io.Reader
	Logger         logrus.FieldLogger
	SkipDeprecated bool // Don't load deprecated config keys
	SkipLegacy     bool // Don't load legacy config files
	SkipAPICalls   bool // Don't do checks that call RailsAPI/controller

	Path                    string
	KeepstorePath           string
	KeepWebPath             string
	CrunchDispatchSlurmPath string
	WebsocketPath           string
	KeepproxyPath           string
	GitHttpdPath            string
	KeepBalancePath         string
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader(stdin io.Reader, logger logrus.FieldLogger) *Loader

NewLoader returns a new Loader with Stdin and Logger set to the given values, and all config paths set to their default values.

func (*Loader) Load

func (ldr *Loader) Load() (*arvados.Config, error)

func (*Loader) MungeLegacyConfigArgs

func (ldr *Loader) MungeLegacyConfigArgs(lgr logrus.FieldLogger, args []string, legacyConfigArg string) []string

MungeLegacyConfigArgs checks args for a -config flag whose argument is a regular file (or a symlink to one), but doesn't have a top-level "Clusters" key and therefore isn't a valid cluster configuration file. If it finds such a flag, it replaces -config with legacyConfigArg (e.g., "-legacy-keepstore-config").

This is used by programs that still need to accept "-config" as a way to specify a per-component config file until their config has been migrated.

If any errors are encountered while reading or parsing a config file, the given args are not munged. We presume the same errors will be encountered again and reported later on when trying to load cluster configuration from the same file, regardless of which struct we end up using.

func (*Loader) RegisterMetrics

func (ldr *Loader) RegisterMetrics(reg *prometheus.Registry)

RegisterMetrics registers metrics showing the timestamp and content hash of the currently loaded config.

Must not be called more than once for a given registry. Must not be called before Load(). Metrics are not updated by subsequent calls to Load().

func (*Loader) SetupFlags

func (ldr *Loader) SetupFlags(flagset *flag.FlagSet)

SetupFlags configures a flagset so arguments like -config X can be used to change the loader's Path fields.

ldr := NewLoader(os.Stdin, logrus.New())
flagset := flag.NewFlagSet("", flag.ContinueOnError)
ldr.SetupFlags(flagset)
// ldr.Path == "/etc/arvados/config.yml"
flagset.Parse([]string{"-config", "/tmp/c.yaml"})
// ldr.Path == "/tmp/c.yaml"

Jump to

Keyboard shortcuts

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