Documentation ¶
Index ¶
- func FileExist(path string) bool
- func SliceGroups(input []string, size int, fn func(group []string))
- func StrToBool(s string) (bool, error)
- func UserConfig() string
- type Choria
- func (c *Choria) CAPath() (string, error)
- func (c *Choria) Certname() string
- func (c *Choria) ClientPrivateKey() (string, error)
- func (c *Choria) ClientPublicCert() (string, error)
- func (c *Choria) DiscoveryServer() (Server, error)
- func (c *Choria) FacterCmd() string
- func (c *Choria) FacterDomain() (string, error)
- func (c *Choria) ProxiedDiscovery() bool
- func (c *Choria) PuppetSetting(setting string) (string, error)
- func (c *Choria) QuerySrvRecords(records []string) ([]Server, error)
- func (c *Choria) SSLContext() (*http.Transport, error)
- func (c *Choria) SSLDir() (string, error)
- func (c *Choria) TrySrvLookup(names []string, defaultSrv Server) (Server, error)
- type ChoriaPluginConfig
- type MCollectiveConfig
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SliceGroups ¶
SliceGroups takes a slice of words and make new chunks of given size and call the function with the sub slice. If there are not enough items in the input slice empty strings will pad the last group
func UserConfig ¶
func UserConfig() string
UserConfig determines what is the active config file for a user TODO: windows
Types ¶
type Choria ¶
type Choria struct {
Config *MCollectiveConfig
}
Choria is a utilty encompasing mcollective and choria config and various utilities
func (*Choria) ClientPrivateKey ¶
ClientPrivateKey determines the location to the client cert
func (*Choria) ClientPublicCert ¶
ClientPublicCert determines the location to the client cert
func (*Choria) DiscoveryServer ¶
DiscoveryServer is the server configured as a discovery proxy
func (*Choria) FacterCmd ¶
FacterCmd finds the path to facter using first AIO path then a `which` like command TODO: windows support
func (*Choria) FacterDomain ¶
FacterDomain determines the machines domain by querying facter. Returns "" when unknown
func (*Choria) ProxiedDiscovery ¶
ProxiedDiscovery determines if a client is configured for proxied discover
func (*Choria) PuppetSetting ¶
PuppetSetting retrieves a config setting by shelling out to puppet apply --configprint
func (*Choria) QuerySrvRecords ¶
QuerySrvRecords looks for SRV records within the right domain either thanks to facter domain or the configured domain.
If the config disables SRV then a error is returned.
func (*Choria) SSLContext ¶
SSLContext creates a SSL context loaded with our certs and ca
type ChoriaPluginConfig ¶
type ChoriaPluginConfig struct { PuppetServerHost string `confkey:"plugin.choria.puppetserver_host" default:"puppet"` PuppetServerPort int `confkey:"plugin.choria.puppetserver_port" default:"8140"` PuppetCAHost string `confkey:"plugin.choria.puppetca_host" default:"puppet"` PuppetCAPort int `confkey:"plugin.choria.puppetca_port" default:"8140"` PuppetDBHost string `confkey:"plugin.choria.puppetdb_host" default:"puppet"` PuppetDBPort int `confkey:"plugin.choria.puppetdb_port" default:"8081"` SSLDir string `confkey:"plugin.choria.ssl_dir"` UseSRVRecords bool `confkey:"plugin.choria.use_srv" default:"true"` SRVDomain string `confkey:"plugin.choria.srv_domain"` // discovery proxy DiscoveryHost string `confkey:"plugin.choria.discovery_host" default:"puppet"` DiscoveryPort int `confkey:"plugin.choria.discovery_port" default:"8085"` DiscoveryProxy bool `confkey:"plugin.choria.discovery_proxy" default:"false"` // federation FederationCollectives []string `confkey:"plugin.choria.federation.collectives" type:"comma_split" environment:"CHORIA_FED_COLLECTIVE"` StatsPort int `configkey:"plugin.choria.stats_port"` // nats connector NatsUser string `confkey:"plugin.nats.user" environment:"MCOLLECTIVE_NATS_USERNAME"` NatsPass string `confkey:"plugin.nats.pass" environment:"MCOLLECTIVE_NATS_PASSWORD"` MiddlewareHosts []string `confkey:"plugin.choria.middleware_hosts" type:"comma_split"` FederationMiddlewareHosts []string `confkey:"plugin.choria.federation_middleware_hosts" type:"comma_split"` RandomizeMiddlewareHosts bool `confkey:"plugin.choria.randomize_middleware_hosts" default:"false"` // security plugin PrivilegedUsers []string `confkey:"plugin.choria.security.privileged_users" type:"comma_split"` CertnameWhitelist []string `confkey:"plugin.choria.security.certname_whitelist" type:"comma_split"` Serializer string `confkey:"plugin.choria.security.serializer"` // TODO support enums }
ChoriaPluginConfig settings
type MCollectiveConfig ¶
type MCollectiveConfig struct { Registration string `confkey:"registration" default:"Agentlist" type:"title_string"` RegistrationCollective string `confkey:"registration_collective"` RegisterInterval int `confkey:"registerinterval" default:"0"` RegistrationSplay bool `confkey:"registration_splay" default:"false"` Collectives []string `confkey:"collectives" type:"comma_split" default:"mcollective"` MainCollective string `confkey:"main_collective"` LogFile string `confkey:"logfile"` KeepLogs int `confkey:"keeplogs" default:"5"` MaxLogSize int `confkey:"max_log_size" default:"2097152"` LogLevel string `confkey:"loglevel" default:"info"` // TODO support enums LogFacility string `confkey:"logfacility" default:"user"` LibDir []string `confkey:"libdir" type:"path_split"` Identity string `confkey:"identity"` DirectAddressing bool `confkey:"direct_addressing" default:"true"` DirectAddressingThreshold int `confkey:"direct_addressing_threshold" default:"10"` Color bool `confkey:"color" default:"true"` Daemonize bool `confkey:"daemonize" default:"false"` SecurityProvider string `confkey:"securityprovider" default:"psk" type:"title_string"` FactSource string `confkey:"factsource" default:"yaml" type:"title_string"` Connector string `confkey:"connector" default:"nats" type:"title_string"` ClassesFile string `confkey:"classesfile" default:"/opt/puppetlabs/puppet/cache/state/classes.txt"` DiscoveryTimeout int `confkey:"discovery_timeout" default:"2"` PublishTimeout int `confkey:"publish_timeout" default:"2"` ConnectionTimeout int `confkey:"connection_timeout"` RPCAudit bool `confkey:"rpcaudit" default:"false"` RPCAuditProvider string `confkey:"rpcauditprovider" type:"title_string"` RPCAuthorization bool `confkey:"rpcauthorization" default:"false"` RPCAuthorizationProvider string `confkey:"rpcauthprovider" type:"title_string"` RPCLimitMethod string `confkey:"rpclimitmethod" default:"first"` // TODO support enums LoggerType string `confkey:"logger_type" default:"file"` FactCacheTime int `confkey:"fact_cache_time" default:"300"` SSLCipher string `confkey:"ssl_cipher" default:"aes-256-cbc"` Threaded bool `confkey:"threaded" default:"false"` TTL int `confkey:"ttl" default:"60"` DefaultDiscoveryOptions []string `confkey:"default_discovery_options"` DefaultDiscoveryMethod string `confkey:"default_discovery_method" default:"mc"` SoftShutdown bool `confkey:"soft_shutdown" default:"false"` SoftShutdownTimeout int `confkey:"soft_shutdown_timeout"` ActivateAgents bool `confkey:"activate_agents" default:"true"` Choria *ChoriaPluginConfig // contains filtered or unexported fields }
MCollectiveConfig represents MCollective configuration
func NewConfig ¶
func NewConfig(path string) (*MCollectiveConfig, error)
NewConfig parses a config file and return the config
func (*MCollectiveConfig) HasOption ¶
func (c *MCollectiveConfig) HasOption(option string) bool
HasOption determines if a specific option was set from a config key. The option given would be something like `plugin.choria.use_srv` and true would indicate that it was set by config vs using defaults