This section is empty.


This section is empty.


func InitializeState

func InitializeState(
	adminUser names.UserTag,
	c agent.ConfigSetter,
	args InitializeStateParams,
	dialOpts mongo.DialOpts,
	newPolicy state.NewPolicyFunc,
) (_ *state.State, _ *state.Machine, resultErr error)

    InitializeState should be called on the bootstrap machine's agent configuration. It uses that information to create the controller, dial the controller, and initialize it. It also generates a new password for the bootstrap machine and calls Write to save the the configuration.

    The cfg values will be stored in the state's ModelConfig; the machineCfg values will be used to configure the bootstrap Machine, and its constraints will be also be used for the model-level constraints. The connection to the controller will respect the given timeout parameter.

    InitializeState returns the newly initialized state and bootstrap machine. If it fails, the state may well be irredeemably compromised.


    type InitializeStateParams

    type InitializeStateParams struct {
    	// BootstrapMachineAddresses holds the bootstrap machine's addresses.
    	BootstrapMachineAddresses []network.Address
    	// BootstrapMachineJobs holds the jobs that the bootstrap machine
    	// agent will run.
    	BootstrapMachineJobs []multiwatcher.MachineJob
    	// SharedSecret is the Mongo replica set shared secret (keyfile).
    	SharedSecret string
    	// Provider is called to obtain an EnvironProvider.
    	Provider func(string) (environs.EnvironProvider, error)
    	// StorageProviderRegistry is used to determine and store the
    	// details of the default storage pools.
    	StorageProviderRegistry storage.ProviderRegistry

      InitializeStateParams holds parameters used for initializing the state database.

      Source Files