Documentation ¶
Index ¶
- func ChangeAgentTools(dataDir string, agentName string, vers version.Binary) (*state.Tools, error)
- func Dir(dataDir, agentName string) string
- func ReadTools(dataDir string, vers version.Binary) (*state.Tools, error)
- func SharedToolsDir(dataDir string, vers version.Binary) string
- func ToolsDir(dataDir, agentName string) string
- func UnpackTools(dataDir string, tools *state.Tools, r io.Reader) (err error)
- type Conf
- func (c *Conf) Check() error
- func (c *Conf) Dir() string
- func (c *Conf) File(name string) string
- func (c *Conf) OpenAPI(dialOpts api.DialOpts) (st *api.State, newPassword string, err error)
- func (c *Conf) OpenState() (*state.State, error)
- func (c *Conf) Tag() string
- func (c *Conf) Write() error
- func (c *Conf) WriteCommands() ([]string, error)
- type DiskManager
- type Tools
- type ToolsManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeAgentTools ¶
ChangeAgentTools atomically replaces the agent-specific symlink under dataDir so it points to the previously unpacked version vers. It returns the new tools read.
func ReadTools ¶
ReadTools checks that the tools for the given version exist in the dataDir directory, and returns a Tools instance describing them.
func SharedToolsDir ¶
SharedToolsDir returns the directory that is used to store binaries for the given version of the juju tools within the dataDir directory.
func ToolsDir ¶
ToolsDir returns the directory that is used/ to store binaries for the tools used by the given agent within the given dataDir directory. Conventionally it is a symbolic link to the actual tools directory.
func UnpackTools ¶
UnpackTools reads a set of juju tools in gzipped tar-archive format and unpacks them into the appropriate tools directory within dataDir. If a valid tools directory already exists, UnpackTools returns without error.
Types ¶
type Conf ¶
type Conf struct { // DataDir specifies the path of the data directory used by all // agents DataDir string // StateServerCert and StateServerKey hold the state server // certificate and private key in PEM format. StateServerCert []byte `yaml:",omitempty"` StateServerKey []byte `yaml:",omitempty"` StatePort int `yaml:",omitempty"` APIPort int `yaml:",omitempty"` // OldPassword specifies a password that should be // used to connect to the state if StateInfo.Password // is blank or invalid. OldPassword string // MachineNonce is set at provisioning/bootstrap time and used to // ensure the agent is running on the correct instance. MachineNonce string // StateInfo specifies how the agent should connect to the // state. The password may be empty if an old password is // specified, or when bootstrapping. StateInfo *state.Info `yaml:",omitempty"` // OldAPIPassword specifies a password that should // be used to connect to the API if APIInfo.Password // is blank or invalid. OldAPIPassword string // APIInfo specifies how the agent should connect to the // state through the API. APIInfo *api.Info `yaml:",omitempty"` }
Conf holds information for a given agent.
func ReadConf ¶
ReadConf reads configuration data for the given entity from the given data directory.
func (*Conf) OpenAPI ¶
OpenAPI tries to open the state using the given Conf. If it returns a non-empty newPassword, the password used to connect to the state should be changed accordingly - the caller should write the configuration with StateInfo.Password set to newPassword, then set the entity's password accordingly.
func (*Conf) Tag ¶
Tag returns the tag of the entity on whose behalf the state connection will be made.
func (*Conf) WriteCommands ¶
WriteCommands returns shell commands to write the agent configuration. It returns an error if the configuration does not have all the right elements.
type DiskManager ¶
type DiskManager struct {
// contains filtered or unexported fields
}
DiskManager keeps track of a collections of Juju agent tools in a directory structure on disk.
func NewDiskManager ¶
func NewDiskManager(dataDir string) *DiskManager
NewDiskManager returns a DiskManager handling a given directory. *DiskManager conforms to the ToolsManager interface
func (*DiskManager) ReadTools ¶
func (d *DiskManager) ReadTools(vers version.Binary) (*Tools, error)
func (*DiskManager) SharedToolsDir ¶
func (d *DiskManager) SharedToolsDir(vers version.Binary) string
func (*DiskManager) UnpackTools ¶
func (d *DiskManager) UnpackTools(tools *Tools, r io.Reader) error
type ToolsManager ¶
type ToolsManager interface { // ReadTools looks in the current storage to see what tools are // available that match the given Binary version. ReadTools(version version.Binary) (*Tools, error) // UnpackTools reads the compressed tarball from the io.Reader and // extracts the tools to be used. tools is used to indicate what exact // version are in the contents of the tarball UnpackTools(tools *Tools, r io.Reader) error }
ToolsManager keeps track of a pool of tools