Documentation ¶
Overview ¶
agent contains jujud's machine agent.
Index ¶
- Variables
- func MachineAgentFactoryFn(agentConfWriter AgentConfigWriter, ...) func(string) *MachineAgent
- func NewEnvironmentStorageDataSource(stor storage.Storage) simplestreams.DataSource
- func NewMachineAgentCmd(machineAgentFactory func(string) *MachineAgent, ...) cmd.Command
- func NewUpgradeWorkerContext() *upgradeWorkerContext
- func OpenAPIState(agentConfig agent.Config, a Agent) (_ *api.State, _ *apiagent.Entity, outErr error)
- func OpenAPIStateUsingInfo(info *api.Info, a Agent, oldPassword string) (*api.State, error)
- type Agent
- type AgentConf
- func (c *AgentConf) AddFlags(f *gnuflag.FlagSet)
- func (ch *AgentConf) ChangeConfig(change AgentConfigMutator) error
- func (c *AgentConf) CheckArgs(args []string) error
- func (ch *AgentConf) CurrentConfig() agent.Config
- func (c *AgentConf) ReadConfig(tag string) error
- func (a *AgentConf) SetAPIHostPorts(servers [][]network.HostPort) error
- func (a *AgentConf) SetStateServingInfo(info params.StateServingInfo) error
- type AgentConfigMutator
- type AgentConfigWriter
- type AgentInitializer
- type AgentState
- type MachineAgent
- func (a *MachineAgent) APIWorker() (worker.Worker, error)
- func (a *MachineAgent) BeginRestore() error
- func (a *MachineAgent) ChangeConfig(mutate AgentConfigMutator) error
- func (a *MachineAgent) Dying() <-chan struct{}
- func (a *MachineAgent) IsRestorePreparing() bool
- func (a *MachineAgent) IsRestoreRunning() bool
- func (a *MachineAgent) PrepareRestore() error
- func (a *MachineAgent) Run(*cmd.Context) error
- func (a *MachineAgent) StateWorker() (worker.Worker, error)
- func (a *MachineAgent) Stop() error
- func (a *MachineAgent) Tag() names.Tag
- func (a *MachineAgent) Wait() error
- func (a *MachineAgent) WorkersStarted() <-chan struct{}
- type MongoSessioner
Constants ¶
This section is empty.
Variables ¶
var (
JujuRun = paths.MustSucceed(paths.JujuRun(version.Current.Series))
)
Functions ¶
func MachineAgentFactoryFn ¶
func MachineAgentFactoryFn( agentConfWriter AgentConfigWriter, apiAddressSetter apiaddressupdater.APIAddressSetter, ) func(string) *MachineAgent
MachineAgentFactoryFn returns a function which instantiates a MachineAgent given a machineId.
func NewEnvironmentStorageDataSource ¶
func NewEnvironmentStorageDataSource(stor storage.Storage) simplestreams.DataSource
NewEnvironmentStorageDataSource returns a new datasource that retrieves metadata from environment storage.
func NewMachineAgentCmd ¶
func NewMachineAgentCmd( machineAgentFactory func(string) *MachineAgent, agentInitializer AgentInitializer, configFetcher AgentConfigWriter, ) cmd.Command
NewMachineAgentCmd creates a Command which handles parsing command-line arguments and instantiating and running a MachineAgent.
func NewUpgradeWorkerContext ¶
func NewUpgradeWorkerContext() *upgradeWorkerContext
Types ¶
type AgentConf ¶
type AgentConf struct { DataDir string // contains filtered or unexported fields }
AgentConf handles command-line flags shared by all agents.
func (*AgentConf) ChangeConfig ¶
func (ch *AgentConf) ChangeConfig(change AgentConfigMutator) error
func (*AgentConf) CurrentConfig ¶
func (*AgentConf) ReadConfig ¶
func (*AgentConf) SetAPIHostPorts ¶
SetAPIHostPorts satisfies worker/apiaddressupdater/APIAddressSetter.
func (*AgentConf) SetStateServingInfo ¶
func (a *AgentConf) SetStateServingInfo(info params.StateServingInfo) error
SetStateServingInfo satisfies worker/certupdater/SetStateServingInfo.
type AgentConfigMutator ¶
type AgentConfigMutator func(agent.ConfigSetter) error
type AgentConfigWriter ¶
type AgentConfigWriter interface { // ReadConfig reads the config for the given tag from disk. ReadConfig(tag string) error // ChangeConfig executes the given AgentConfigMutator in a // thread-safe context. ChangeConfig(AgentConfigMutator) error // CurrentConfig returns a copy of the in-memory agent config. CurrentConfig() agent.Config }
AgentConfigWriter encapsulates disk I/O operations with the agent config.
type AgentInitializer ¶
AgentInitializer handles initializing a type for use as a Jujud agent.
type AgentState ¶
type AgentState interface { // SetAgentVersion sets the tools version that the agent is // currently running. SetAgentVersion(v version.Binary) error Tag() string Life() state.Life }
The AgentState interface is implemented by state types that represent running agents.
type MachineAgent ¶
type MachineAgent struct { AgentConfigWriter // contains filtered or unexported fields }
MachineAgent is responsible for tying together all functionality needed to orchestarte a Jujud instance which controls a machine.
func NewMachineAgent ¶
func NewMachineAgent( machineId string, agentConfWriter AgentConfigWriter, apiAddressSetter apiaddressupdater.APIAddressSetter, upgradeWorkerContext *upgradeWorkerContext, runner worker.Runner, ) *MachineAgent
NewMachineAgent instantiates a new MachineAgent.
func (*MachineAgent) APIWorker ¶
func (a *MachineAgent) APIWorker() (worker.Worker, error)
APIWorker returns a Worker that connects to the API and starts any workers that need an API connection.
func (*MachineAgent) BeginRestore ¶
func (a *MachineAgent) BeginRestore() error
BeginRestore will flag the agent to disallow all commands since restore should be running and therefore making changes that would override anything done.
func (*MachineAgent) ChangeConfig ¶
func (a *MachineAgent) ChangeConfig(mutate AgentConfigMutator) error
func (*MachineAgent) Dying ¶
func (a *MachineAgent) Dying() <-chan struct{}
Dying returns the channel that can be used to see if the machine agent is terminating.
func (*MachineAgent) IsRestorePreparing ¶
func (a *MachineAgent) IsRestorePreparing() bool
IsRestorePreparing returns bool representing if we are in restore mode but not running restore.
func (*MachineAgent) IsRestoreRunning ¶
func (a *MachineAgent) IsRestoreRunning() bool
IsRestoreRunning returns bool representing if we are in restore mode and running the actual restore process.
func (*MachineAgent) PrepareRestore ¶
func (a *MachineAgent) PrepareRestore() error
PrepareRestore will flag the agent to allow only a limited set of commands defined in "github.com/juju/juju/apiserver".allowedMethodsAboutToRestore the most noteworthy is: Backups.Restore: this will ensure that we can do all the file movements required for restore and no one will do changes while we do that. it will return error if the machine is already in this state.
func (*MachineAgent) StateWorker ¶
func (a *MachineAgent) StateWorker() (worker.Worker, error)
StateWorker returns a worker running all the workers that require a *state.State connection.
func (*MachineAgent) Tag ¶
func (a *MachineAgent) Tag() names.Tag
func (*MachineAgent) Wait ¶
func (a *MachineAgent) Wait() error
Wait waits for the machine agent to finish.
func (*MachineAgent) WorkersStarted ¶
func (a *MachineAgent) WorkersStarted() <-chan struct{}
WorkersStarted returns a channel that's closed once all top level workers have been started. This is provided for testing purposes.
type MongoSessioner ¶
type MongoSessioner interface {
MongoSession() *mgo.Session
}