Skip to content

Commit

Permalink
Fixed merge conflicts from master
Browse files Browse the repository at this point in the history
  • Loading branch information
jujubot authored and Dimiter Naydenov committed Feb 3, 2016
1 parent b9f4246 commit 9296a57
Show file tree
Hide file tree
Showing 958 changed files with 16,330 additions and 19,075 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ juju is devops distilled.

Juju enables you to use [Charms](http://juju.ubuntu.com/charms) to deploy your application architectures to EC2, OpenStack,
Azure, HP your data center and even your own Ubuntu based laptop.
Moving between environments is simple giving you the flexibility to switch hosts
Moving between models is simple giving you the flexibility to switch hosts
whenever you want — for free.

For more information, see the [docs](https://jujucharms.com/docs/stable/getting-started).
Expand Down Expand Up @@ -110,7 +110,7 @@ commands. You can verify this using

which juju

You should be able to bootstrap a local environment now with the following
You should be able to bootstrap a local model now with the following
(Note: the use of sudo for bootstrap here is only required for the local
provider because it uses LXC, which requires root privileges)

Expand All @@ -127,10 +127,10 @@ are extracted and uploaded to a known location. This consumes a release version
number, and implies that no tools are available for the next, development, version
of juju. Therefore, when using the development version of juju you will need to
pass an additional flag, `--upload-tools` to instruct the `juju` client to build
a set of tools from source and upload them to the environment as part of the
a set of tools from source and upload them to the model as part of the
bootstrap process.

juju bootstrap -e your-environment --upload-tools {--debug}
juju bootstrap -m your-model --upload-tools {--debug}


Installing bash completion for juju
Expand Down
43 changes: 20 additions & 23 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ const (
ProviderType = "PROVIDER_TYPE"
ContainerType = "CONTAINER_TYPE"
Namespace = "NAMESPACE"
StorageDir = "STORAGE_DIR"
StorageAddr = "STORAGE_ADDR"
AgentServiceName = "AGENT_SERVICE_NAME"
MongoOplogSize = "MONGO_OPLOG_SIZE"
NumaCtlPreference = "NUMA_CTL_PREFERENCE"
Expand Down Expand Up @@ -244,9 +242,8 @@ type Config interface {
// available) when connecting to the state or API server.
PreferIPv6() bool

// Environment returns the tag for the environment that the agent belongs
// to.
Environment() names.EnvironTag
// Model returns the tag for the model that the agent belongs to.
Model() names.ModelTag

// MetricsSpoolDir returns the spool directory where workloads store
// collected metrics.
Expand Down Expand Up @@ -330,7 +327,7 @@ type MigrateParams struct {
Jobs []multiwatcher.MachineJob
DeleteValues []string
Values map[string]string
Environment names.EnvironTag
Model names.ModelTag
}

// Ensure that the configInternal struct implements the Config interface.
Expand All @@ -355,7 +352,7 @@ type configInternal struct {
paths Paths
tag names.Tag
nonce string
environment names.EnvironTag
model names.ModelTag
jobs []multiwatcher.MachineJob
upgradedToVersion version.Number
caCert string
Expand All @@ -374,7 +371,7 @@ type AgentConfigParams struct {
Tag names.Tag
Password string
Nonce string
Environment names.EnvironTag
Model names.ModelTag
StateAddresses []string
APIAddresses []string
CACert string
Expand Down Expand Up @@ -403,10 +400,10 @@ func NewAgentConfig(configParams AgentConfigParams) (ConfigSetterWriter, error)
if configParams.Password == "" {
return nil, errors.Trace(requiredError("password"))
}
if uuid := configParams.Environment.Id(); uuid == "" {
return nil, errors.Trace(requiredError("environment"))
} else if !names.IsValidEnvironment(uuid) {
return nil, errors.Errorf("%q is not a valid environment uuid", uuid)
if uuid := configParams.Model.Id(); uuid == "" {
return nil, errors.Trace(requiredError("model"))
} else if !names.IsValidModel(uuid) {
return nil, errors.Errorf("%q is not a valid model uuid", uuid)
}
if len(configParams.CACert) == 0 {
return nil, errors.Trace(requiredError("CA certificate"))
Expand All @@ -419,7 +416,7 @@ func NewAgentConfig(configParams AgentConfigParams) (ConfigSetterWriter, error)
upgradedToVersion: configParams.UpgradedToVersion,
tag: configParams.Tag,
nonce: configParams.Nonce,
environment: configParams.Environment,
model: configParams.Model,
caCert: configParams.CACert,
oldPassword: configParams.Password,
values: configParams.Values,
Expand Down Expand Up @@ -577,8 +574,8 @@ func (config *configInternal) Migrate(newParams MigrateParams) error {
}
config.values[key] = value
}
if newParams.Environment.Id() != "" {
config.environment = newParams.Environment
if newParams.Model.Id() != "" {
config.model = newParams.Model
}
if err := config.check(); err != nil {
return fmt.Errorf("migrated agent config is invalid: %v", err)
Expand Down Expand Up @@ -718,8 +715,8 @@ func (c *configInternal) Tag() names.Tag {
return c.tag
}

func (c *configInternal) Environment() names.EnvironTag {
return c.environment
func (c *configInternal) Model() names.ModelTag {
return c.model
}

func (c *configInternal) Dir() string {
Expand Down Expand Up @@ -806,12 +803,12 @@ func (c *configInternal) APIInfo() (*api.Info, bool) {
}
}
return &api.Info{
Addrs: addrs,
Password: c.apiDetails.password,
CACert: c.caCert,
Tag: c.tag,
Nonce: c.nonce,
EnvironTag: c.environment,
Addrs: addrs,
Password: c.apiDetails.password,
CACert: c.caCert,
Tag: c.tag,
Nonce: c.nonce,
ModelTag: c.model,
}, true
}

Expand Down
56 changes: 28 additions & 28 deletions agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,32 +59,32 @@ var agentConfigTests = []struct {
},
checkErr: "password not found in configuration",
}, {
about: "missing environment tag",
about: "missing model tag",
params: agent.AgentConfigParams{
Paths: agent.Paths{DataDir: "/data/dir"},
Tag: names.NewMachineTag("1"),
UpgradedToVersion: version.Current,
Password: "sekrit",
},
checkErr: "environment not found in configuration",
checkErr: "model not found in configuration",
}, {
about: "invalid environment tag",
about: "invalid model tag",
params: agent.AgentConfigParams{
Paths: agent.Paths{DataDir: "/data/dir"},
Tag: names.NewMachineTag("1"),
UpgradedToVersion: version.Current,
Password: "sekrit",
Environment: names.NewEnvironTag("uuid"),
Model: names.NewModelTag("uuid"),
},
checkErr: `"uuid" is not a valid environment uuid`,
checkErr: `"uuid" is not a valid model uuid`,
}, {
about: "missing CA cert",
params: agent.AgentConfigParams{
Paths: agent.Paths{DataDir: "/data/dir"},
Tag: names.NewMachineTag("1"),
UpgradedToVersion: version.Current,
Password: "sekrit",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
},
checkErr: "CA certificate not found in configuration",
}, {
Expand All @@ -95,7 +95,7 @@ var agentConfigTests = []struct {
UpgradedToVersion: version.Current,
Password: "sekrit",
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
},
checkErr: "state or API addresses not found in configuration",
}, {
Expand All @@ -106,7 +106,7 @@ var agentConfigTests = []struct {
UpgradedToVersion: version.Current,
Password: "sekrit",
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
StateAddresses: []string{"localhost:8080", "bad-address"},
},
checkErr: `invalid state server address "bad-address"`,
Expand All @@ -118,7 +118,7 @@ var agentConfigTests = []struct {
UpgradedToVersion: version.Current,
Password: "sekrit",
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
APIAddresses: []string{"localhost:8080", "bad-address"},
},
checkErr: `invalid API server address "bad-address"`,
Expand All @@ -130,7 +130,7 @@ var agentConfigTests = []struct {
UpgradedToVersion: version.Current,
Password: "sekrit",
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
StateAddresses: []string{"localhost:1234"},
},
}, {
Expand All @@ -141,7 +141,7 @@ var agentConfigTests = []struct {
UpgradedToVersion: version.Current,
Password: "sekrit",
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
APIAddresses: []string{"localhost:1234"},
},
}, {
Expand All @@ -152,7 +152,7 @@ var agentConfigTests = []struct {
UpgradedToVersion: version.Current,
Password: "sekrit",
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
StateAddresses: []string{"localhost:1234"},
APIAddresses: []string{"localhost:1235"},
},
Expand All @@ -164,7 +164,7 @@ var agentConfigTests = []struct {
Password: "sekrit",
UpgradedToVersion: version.Current,
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
StateAddresses: []string{"localhost:1234"},
APIAddresses: []string{"localhost:1235"},
Nonce: "a nonce",
Expand All @@ -177,7 +177,7 @@ var agentConfigTests = []struct {
Password: "sekrit",
UpgradedToVersion: version.Current,
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
StateAddresses: []string{"localhost:1234"},
APIAddresses: []string{"localhost:1235"},
Nonce: "a nonce",
Expand All @@ -193,7 +193,7 @@ var agentConfigTests = []struct {
Password: "sekrit",
UpgradedToVersion: version.Current,
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
StateAddresses: []string{"localhost:1234"},
APIAddresses: []string{"localhost:1235"},
Nonce: "a nonce",
Expand All @@ -212,7 +212,7 @@ var agentConfigTests = []struct {
Password: "sekrit",
UpgradedToVersion: version.Current,
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
StateAddresses: []string{"localhost:1234"},
APIAddresses: []string{"localhost:1235"},
Nonce: "a nonce",
Expand All @@ -236,7 +236,7 @@ var agentConfigTests = []struct {
Tag: names.NewUnitTag("ubuntu/1"),
Password: "sekrit",
UpgradedToVersion: version.Current,
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
CACert: "ca cert",
StateAddresses: []string{"localhost:1234"},
APIAddresses: []string{"localhost:1235"},
Expand All @@ -252,7 +252,7 @@ var agentConfigTests = []struct {
Password: "sekrit",
UpgradedToVersion: version.Current,
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
StateAddresses: []string{"localhost:1234"},
APIAddresses: []string{"localhost:1235"},
Nonce: "a nonce",
Expand All @@ -269,7 +269,7 @@ var agentConfigTests = []struct {
Password: "sekrit",
UpgradedToVersion: version.Current,
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
StateAddresses: []string{"localhost:1234"},
APIAddresses: []string{"localhost:1235"},
Nonce: "a nonce",
Expand Down Expand Up @@ -305,11 +305,11 @@ func (*suite) TestMigrate(c *gc.C) {
Password: "secret",
UpgradedToVersion: version.MustParse("1.16.5"),
Jobs: []multiwatcher.MachineJob{
multiwatcher.JobManageEnviron,
multiwatcher.JobManageModel,
multiwatcher.JobHostUnits,
},
CACert: "ca cert",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
StateAddresses: []string{"localhost:1234"},
APIAddresses: []string{"localhost:4321"},
Values: map[string]string{
Expand Down Expand Up @@ -512,7 +512,7 @@ var attributeParams = agent.AgentConfigParams{
StateAddresses: []string{"localhost:1234"},
APIAddresses: []string{"localhost:1235"},
Nonce: "a nonce",
Environment: testing.EnvironmentTag,
Model: testing.ModelTag,
}

func (*suite) TestAttributes(c *gc.C) {
Expand Down Expand Up @@ -674,12 +674,12 @@ func (*suite) TestSetPassword(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)

expectAPIInfo := &api.Info{
Addrs: attrParams.APIAddresses,
CACert: attrParams.CACert,
Tag: attrParams.Tag,
Password: "",
Nonce: attrParams.Nonce,
EnvironTag: attrParams.Environment,
Addrs: attrParams.APIAddresses,
CACert: attrParams.CACert,
Tag: attrParams.Tag,
Password: "",
Nonce: attrParams.Nonce,
ModelTag: attrParams.Model,
}
apiInfo, ok := conf.APIInfo()
c.Assert(ok, jc.IsTrue)
Expand Down
19 changes: 8 additions & 11 deletions agent/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ type BootstrapMachineConfig struct {
// BootstrapConstraints holds the bootstrap machine's constraints.
BootstrapConstraints constraints.Value

// EnvironConstraints holds the environment-level constraints.
EnvironConstraints constraints.Value
// ModelConstraints holds the model-level constraints.
ModelConstraints constraints.Value

// Jobs holds the jobs that the machine agent will run.
Jobs []multiwatcher.MachineJob
Expand All @@ -58,9 +58,9 @@ const BootstrapMachineId = "0"
// state server, and initialize it. It also generates a new password for the
// bootstrap machine and calls Write to save the the configuration.
//
// The envCfg values will be stored in the state's EnvironConfig; the
// The envCfg 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 environment-level
// and its constraints will be also be used for the model-level
// constraints. The connection to the state server will respect the
// given timeout parameter.
//
Expand Down Expand Up @@ -106,7 +106,7 @@ func InitializeState(adminUser names.UserTag, c ConfigSetter, envCfg *config.Con
if !isLocalEnv(envCfg) {
machineCfg.Addresses = network.FilterLXCAddresses(machineCfg.Addresses)
} else {
logger.Debugf("local environment - not filtering addresses from %v", machineCfg.Addresses)
logger.Debugf("local model - not filtering addresses from %v", machineCfg.Addresses)
}

if err = initAPIHostPorts(c, st, machineCfg.Addresses, servingInfo.APIPort); err != nil {
Expand Down Expand Up @@ -142,7 +142,7 @@ func paramsStateServingInfoToStateStateServingInfo(i params.StateServingInfo) st
}

func initConstraintsAndBootstrapMachine(c ConfigSetter, st *state.State, cfg BootstrapMachineConfig) (*state.Machine, error) {
if err := st.SetEnvironConstraints(cfg.EnvironConstraints); err != nil {
if err := st.SetModelConstraints(cfg.ModelConstraints); err != nil {
return nil, errors.Errorf("cannot set initial environ constraints: %v", err)
}
m, err := initBootstrapMachine(c, st, cfg)
Expand Down Expand Up @@ -233,13 +233,10 @@ func machineJobFromParams(job multiwatcher.MachineJob) (state.MachineJob, error)
switch job {
case multiwatcher.JobHostUnits:
return state.JobHostUnits, nil
case multiwatcher.JobManageEnviron:
return state.JobManageEnviron, nil
case multiwatcher.JobManageModel:
return state.JobManageModel, nil
case multiwatcher.JobManageNetworking:
return state.JobManageNetworking, nil
case multiwatcher.JobManageStateDeprecated:
// Deprecated in 1.18.
return state.JobManageStateDeprecated, nil
default:
return -1, errors.Errorf("invalid machine job %q", job)
}
Expand Down
Loading

0 comments on commit 9296a57

Please sign in to comment.