config

package
v0.0.0-...-acd7349 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2013 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FwDefault is the environment-specific default mode.
	FwDefault FirewallMode = ""

	// FwInstance requests the use of an individual firewall per instance.
	FwInstance FirewallMode = "instance"

	// FwGlobal requests the use of a single firewall group for all machines.
	// When ports are opened for one machine, all machines will have the same
	// port opened.
	FwGlobal FirewallMode = "global"

	// DefaultSeries returns the most recent Ubuntu LTS release name.
	DefaultSeries string = "precise"

	// DefaultStatePort is the default port the state server is listening on.
	DefaultStatePort int = 37017

	// DefaultApiPort is the default port the API server is listening on.
	DefaultApiPort int = 17070
)

Variables

This section is empty.

Functions

func JujuHome

func JujuHome() string

JujuHome returns the current juju home.

func JujuHomePath

func JujuHomePath(names ...string) string

JujuHomePath returns the path to a file in the current juju home.

func SetJujuHome

func SetJujuHome(newJujuHome string) string

SetJujuHome sets the value of juju home and returns the current one.

func Validate

func Validate(cfg, old *Config) error

Validate ensures that config is a valid configuration. If old is not nil, it holds the previous environment configuration for consideration when validating changes.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config holds an immutable environment configuration.

func New

func New(attrs map[string]interface{}) (*Config, error)

New returns a new configuration. Fields that are common to all environment providers are verified. The "authorized-keys-path" key is translated into "authorized-keys" by loading the content from respective file. Similarly, "ca-cert-path" and "ca-private-key-path" are translated into the "ca-cert" and "ca-private-key" values. If not specified, authorized SSH keys and CA details will be read from:

~/.ssh/id_dsa.pub
~/.ssh/id_rsa.pub
~/.ssh/identity.pub
~/.juju/<name>-cert.pem
~/.juju/<name>-private-key.pem

The required keys (after any files have been read) are "name", "type" and "authorized-keys", all of type string. Additional keys recognised are "agent-version" and "development", of types string and bool respectively.

func (*Config) APIPort

func (c *Config) APIPort() int

APIPort returns the API server port for the environment.

func (*Config) AdminSecret

func (c *Config) AdminSecret() string

AdminSecret returns the administrator password. It's empty if the password has not been set.

func (*Config) AgentVersion

func (c *Config) AgentVersion() (version.Number, bool)

AgentVersion returns the proposed version number for the agent tools, and whether it has been set. Once an environment is bootstrapped, this must always be valid.

func (*Config) AllAttrs

func (c *Config) AllAttrs() map[string]interface{}

AllAttrs returns a copy of the raw configuration attributes.

func (*Config) Apply

func (c *Config) Apply(attrs map[string]interface{}) (*Config, error)

Apply returns a new configuration that has the attributes of c plus attrs.

func (*Config) AuthorizedKeys

func (c *Config) AuthorizedKeys() string

AuthorizedKeys returns the content for ssh's authorized_keys file.

func (*Config) CACert

func (c *Config) CACert() ([]byte, bool)

CACert returns the certificate of the CA that signed the state server certificate, in PEM format, and whether the setting is available.

func (*Config) CAPrivateKey

func (c *Config) CAPrivateKey() (key []byte, ok bool)

CAPrivateKey returns the private key of the CA that signed the state server certificate, in PEM format, and whether the setting is available.

func (*Config) DefaultSeries

func (c *Config) DefaultSeries() string

DefaultSeries returns the default Ubuntu series for the environment.

func (*Config) Development

func (c *Config) Development() bool

Development returns whether the environment is in development mode.

func (*Config) FirewallMode

func (c *Config) FirewallMode() FirewallMode

FirewallMode returns whether the firewall should manage ports per machine or global.

func (*Config) GenerateStateServerCertAndKey

func (cfg *Config) GenerateStateServerCertAndKey() ([]byte, []byte, error)

GenerateStateServerCertAndKey makes sure that the config has a CACert and CAPrivateKey, generates and retruns new certificate and key.

func (*Config) Name

func (c *Config) Name() string

Name returns the environment name.

func (*Config) SSLHostnameVerification

func (c *Config) SSLHostnameVerification() bool

SSLHostnameVerification returns weather the environment has requested SSL hostname verification to be enabled.

func (*Config) StatePort

func (c *Config) StatePort() int

StatePort returns the state server port for the environment.

func (*Config) Type

func (c *Config) Type() string

Type returns the environment type.

func (*Config) UnknownAttrs

func (c *Config) UnknownAttrs() map[string]interface{}

UnknownAttrs returns a copy of the raw configuration attributes that are supposedly specific to the environment type. They could also be wrong attributes, though. Only the specific environment implementation can tell.

func (*Config) ValidateUnknownAttrs

func (cfg *Config) ValidateUnknownAttrs(fields schema.Fields, defaults schema.Defaults) (map[string]interface{}, error)

ValidateUnknownAttrs checks the unknown attributes of the config against the supplied fields and defaults, and returns an error if any fails to validate. Unknown fields are warned about, but preserved, on the basis that they are reasonably likely to have been written by or for a version of juju that does recognise the fields, but that their presence is still anomalous to some degree and should be flagged (and that there is thereby a mechanism for observing fields that really are typos etc).

type FirewallMode

type FirewallMode string

FirewallMode defines the way in which the environment handles opening and closing of firewall ports.

Jump to

Keyboard shortcuts

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