Skip to content

Commit

Permalink
Rename EnvironConfig and a bunch of other environ related artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
wallyworld committed Jan 27, 2016
1 parent ca623bc commit f75f108
Show file tree
Hide file tree
Showing 353 changed files with 1,808 additions and 1,848 deletions.
2 changes: 1 addition & 1 deletion agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ 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",
Expand Down
6 changes: 3 additions & 3 deletions agent/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ 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
// constraints. The connection to the state server will respect the
Expand Down Expand Up @@ -222,8 +222,8 @@ 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:
Expand Down
12 changes: 6 additions & 6 deletions agent/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ LXC_BRIDGE="ignored"`[1:])
Addresses: initialAddrs,
BootstrapConstraints: expectBootstrapConstraints,
EnvironConstraints: expectEnvironConstraints,
Jobs: []multiwatcher.MachineJob{multiwatcher.JobManageEnviron},
Jobs: []multiwatcher.MachineJob{multiwatcher.JobManageModel},
InstanceId: "i-bootstrap",
Characteristics: expectHW,
SharedSecret: "abc123",
Expand Down Expand Up @@ -168,7 +168,7 @@ LXC_BRIDGE="ignored"`[1:])

// Check that environment configuration has been added, and
// environment constraints set.
newEnvCfg, err := st.EnvironConfig()
newEnvCfg, err := st.ModelConfig()
c.Assert(err, jc.ErrorIsNil)
c.Assert(newEnvCfg.AllAttrs(), gc.DeepEquals, envCfg.AllAttrs())
gotEnvironConstraints, err := st.EnvironConstraints()
Expand All @@ -177,7 +177,7 @@ LXC_BRIDGE="ignored"`[1:])

// Check that the bootstrap machine looks correct.
c.Assert(m.Id(), gc.Equals, "0")
c.Assert(m.Jobs(), gc.DeepEquals, []state.MachineJob{state.JobManageEnviron})
c.Assert(m.Jobs(), gc.DeepEquals, []state.MachineJob{state.JobManageModel})
c.Assert(m.Series(), gc.Equals, series.HostSeries())
c.Assert(m.CheckProvisioned(agent.BootstrapNonce), jc.IsTrue)
c.Assert(m.Addresses(), jc.DeepEquals, filteredAddrs)
Expand Down Expand Up @@ -272,7 +272,7 @@ func (s *bootstrapSuite) TestInitializeStateFailsSecondTime(c *gc.C) {
expectHW := instance.MustParseHardware("mem=2048M")
mcfg := agent.BootstrapMachineConfig{
BootstrapConstraints: constraints.MustParse("mem=1024M"),
Jobs: []multiwatcher.MachineJob{multiwatcher.JobManageEnviron},
Jobs: []multiwatcher.MachineJob{multiwatcher.JobManageModel},
InstanceId: "i-bootstrap",
Characteristics: expectHW,
}
Expand Down Expand Up @@ -304,8 +304,8 @@ func (s *bootstrapSuite) TestMachineJobFromParams(c *gc.C) {
name: multiwatcher.JobHostUnits,
want: state.JobHostUnits,
}, {
name: multiwatcher.JobManageEnviron,
want: state.JobManageEnviron,
name: multiwatcher.JobManageModel,
want: state.JobManageModel,
}, {
name: multiwatcher.JobManageNetworking,
want: state.JobManageNetworking,
Expand Down
6 changes: 3 additions & 3 deletions agent/format-1.18_whitebox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (*format_1_18Suite) TestReadConfWithExisting1_18ConfigFileContents(c *gc.C)
config, err := ReadConfig(configPath)
c.Assert(err, jc.ErrorIsNil)
c.Assert(config.UpgradedToVersion(), jc.DeepEquals, version.MustParse("1.17.5.1"))
c.Assert(config.Jobs(), jc.DeepEquals, []multiwatcher.MachineJob{multiwatcher.JobManageEnviron})
c.Assert(config.Jobs(), jc.DeepEquals, []multiwatcher.MachineJob{multiwatcher.JobManageModel})
c.Assert(config.PreferIPv6(), jc.IsTrue)
}

Expand All @@ -89,7 +89,7 @@ datadir: /home/user/.juju/local
logdir: /var/log/juju-user-local
nonce: user-admin:bootstrap
jobs:
- JobManageEnviron
- JobManageModel
upgradedToVersion: 1.17.5.1
cacert: '-----BEGIN CERTIFICATE-----
Expand Down Expand Up @@ -238,7 +238,7 @@ datadir: /home/user/.juju/local
logdir: /var/log/juju-user-local
nonce: user-admin:bootstrap
jobs:
- JobManageEnviron
- JobManageModel
upgradedToVersion: 1.17.5.1
cacert: '-----BEGIN CERTIFICATE-----
Expand Down
2 changes: 1 addition & 1 deletion api/addresser/addresser.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewAPI(caller base.APICaller) *API {
}
}

// CanDeallocateAddresses checks if the current environment can
// CanDeallocateAddresses checks if the current model can
// deallocate IP addresses.
func (api *API) CanDeallocateAddresses() (bool, error) {
var result params.BoolResult
Expand Down
4 changes: 2 additions & 2 deletions api/agent/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type servingInfoSuite struct {
var _ = gc.Suite(&servingInfoSuite{})

func (s *servingInfoSuite) TestStateServingInfo(c *gc.C) {
st, _ := s.OpenAPIAsNewMachine(c, state.JobManageEnviron)
st, _ := s.OpenAPIAsNewMachine(c, state.JobManageModel)

ssi := state.StateServingInfo{
PrivateKey: "some key",
Expand Down Expand Up @@ -72,7 +72,7 @@ func (s *servingInfoSuite) TestIsMaster(c *gc.C) {
}
s.PatchValue(&apiserveragent.MongoIsMaster, fakeMongoIsMaster)

st, _ := s.OpenAPIAsNewMachine(c, state.JobManageEnviron)
st, _ := s.OpenAPIAsNewMachine(c, state.JobManageModel)
expected := true
result, err := st.Agent().IsMaster()

Expand Down
2 changes: 1 addition & 1 deletion api/agent/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (st *State) StateServingInfo() (params.StateServingInfo, error) {
// agent lives at the same network address as the primary
// mongo server for the replica set.
// This call will return an error if the connected
// agent is not a machine agent with environment-manager
// agent is not a machine agent with model-manager
// privileges.
func (st *State) IsMaster() (bool, error) {
var results params.IsMasterResult
Expand Down
16 changes: 8 additions & 8 deletions api/allwatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

// AllWatcher holds information allowing us to get Deltas describing
// changes to the entire environment or all environments (depending on
// changes to the entire model or all models (depending on
// the watcher type).
type AllWatcher struct {
objType string
Expand All @@ -27,14 +27,14 @@ func NewAllWatcher(caller base.APICaller, id *string) *AllWatcher {
return newAllWatcher("AllWatcher", caller, id)
}

// NewAllEnvWatcher returns an AllWatcher instance which interacts
// with a watcher created by the WatchAllEnvs API call.
// NewAllModelWatcher returns an AllWatcher instance which interacts
// with a watcher created by the WatchAllModels API call.
//
// There should be no need to call this from outside of the api
// package. It is only used by Client.WatchAllEnvs in
// package. It is only used by Client.WatchAllModels in
// api/controller.
func NewAllEnvWatcher(caller base.APICaller, id *string) *AllWatcher {
return newAllWatcher("AllEnvWatcher", caller, id)
func NewAllModelWatcher(caller base.APICaller, id *string) *AllWatcher {
return newAllWatcher("AllModelWatcher", caller, id)
}

func newAllWatcher(objType string, caller base.APICaller, id *string) *AllWatcher {
Expand All @@ -46,7 +46,7 @@ func newAllWatcher(objType string, caller base.APICaller, id *string) *AllWatche
}

// Next returns a new set of deltas from a watcher previously created
// by the WatchAll or WatchAllEnvs API calls. It will block until
// by the WatchAll or WatchAllModels API calls. It will block until
// there are deltas to return.
func (watcher *AllWatcher) Next() ([]multiwatcher.Delta, error) {
var info params.AllWatcherNextResults
Expand All @@ -61,7 +61,7 @@ func (watcher *AllWatcher) Next() ([]multiwatcher.Delta, error) {
}

// Stop shutdowns down a watcher previously created by the WatchAll or
// WatchAllEnvs API calls
// WatchAllModels API calls
func (watcher *AllWatcher) Stop() error {
return watcher.caller.APICall(
watcher.objType,
Expand Down
2 changes: 1 addition & 1 deletion api/apiclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (s *apiclientSuite) TestOpenHonorsEnvironTag(c *gc.C) {
st.Close()

// Backwards compatibility, we should succeed if we do not set an
// environ tag
// model tag
info.ModelTag = names.NewModelTag("")
st, err = api.Open(info, api.DialOpts{})
c.Assert(err, jc.ErrorIsNil)
Expand Down
2 changes: 1 addition & 1 deletion api/backups/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (s *baseSuite) checkMetadataResult(c *gc.C, result *params.BackupsMetadataR
c.Check(result.Stored, gc.Equals, stored)
c.Check(result.Notes, gc.Equals, meta.Notes)

c.Check(result.Environment, gc.Equals, meta.Origin.Environment)
c.Check(result.Model, gc.Equals, meta.Origin.Model)
c.Check(result.Machine, gc.Equals, meta.Origin.Machine)
c.Check(result.Hostname, gc.Equals, meta.Origin.Hostname)
c.Check(result.Version, gc.Equals, meta.Origin.Version)
Expand Down
4 changes: 2 additions & 2 deletions api/backups/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func (s *uploadSuite) TestFailedRequest(c *gc.C) {
meta := apiserverbackups.ResultFromMetadata(s.Meta)
meta.ID = ""
meta.Size = int64(len(data))
// The Environment field is required, so zero it so that
// The Model field is required, so zero it so that
// we'll get an error from the endpoint.
meta.Environment = ""
meta.Model = ""

id, err := s.client.Upload(archive, meta)
c.Assert(err, gc.ErrorMatches, `PUT https://.*/model/.*/backups: while storing backup archive: missing Model`)
Expand Down
6 changes: 3 additions & 3 deletions api/base/caller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ type APICaller interface {
// client can use with the current API server.
BestFacadeVersion(facade string) int

// ModelTag returns the tag of the environment the client is
// ModelTag returns the tag of the model the client is
// connected to.
ModelTag() (names.ModelTag, error)

// HTTPClient returns an httprequest.Client that can be used
// to make HTTP requests to the API. URLs passed to the client
// will be made relative to the API host and the current environment.
// will be made relative to the API host and the current model.
//
// Note that the URLs in HTTP requests passed to the Client.Do
// method should not include a host part.
Expand All @@ -54,7 +54,7 @@ type APICaller interface {
type StreamConnector interface {
// ConnectStream connects to the given HTTP websocket
// endpoint path (interpreted relative to the receiver's
// environment) and returns the resulting connection.
// model) and returns the resulting connection.
// The given parameters are used as URL query values
// when making the initial HTTP request.
//
Expand Down
6 changes: 3 additions & 3 deletions api/block/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewClient(st base.APICallCloser) *Client {
return &Client{ClientFacade: frontend, facade: backend}
}

// List returns blocks that are switched on for current environment.
// List returns blocks that are switched on for current model.
func (c *Client) List() ([]params.Block, error) {
blocks := params.BlockResults{}
if err := c.facade.FacadeCall("List", nil, &blocks); err != nil {
Expand All @@ -46,7 +46,7 @@ func (c *Client) List() ([]params.Block, error) {
return all, allErr.Combine()
}

// SwitchBlockOn switches desired block on for the current environment.
// SwitchBlockOn switches desired block on for the current model.
// Valid block types are "BlockDestroy", "BlockRemove" and "BlockChange".
func (c *Client) SwitchBlockOn(blockType, msg string) error {
args := params.BlockSwitchParams{
Expand All @@ -63,7 +63,7 @@ func (c *Client) SwitchBlockOn(blockType, msg string) error {
return nil
}

// SwitchBlockOff switches desired block off for the current environment.
// SwitchBlockOff switches desired block off for the current model.
// Valid block types are "BlockDestroy", "BlockRemove" and "BlockChange".
func (c *Client) SwitchBlockOff(blockType string) error {
args := params.BlockSwitchParams{
Expand Down
2 changes: 1 addition & 1 deletion api/charmrevisionupdater/updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (s *versionUpdaterSuite) SetUpTest(c *gc.C) {
s.JujuConnSuite.SetUpTest(c)
s.CharmSuite.SetUpTest(c)

machine, err := s.State.AddMachine("quantal", state.JobManageEnviron)
machine, err := s.State.AddMachine("quantal", state.JobManageModel)
c.Assert(err, jc.ErrorIsNil)
password, err := utils.RandomPassword()
c.Assert(err, jc.ErrorIsNil)
Expand Down
4 changes: 2 additions & 2 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ func (c *Client) UnshareModel(users ...names.UserTag) error {
return result.Combine()
}

// WatchAll holds the id of the newly-created AllWatcher/AllEnvWatcher.
// WatchAll holds the id of the newly-created AllWatcher/AllModelWatcher.
type WatchAll struct {
AllWatcherId string
}
Expand All @@ -456,7 +456,7 @@ func (c *Client) GetAnnotations(tag string) (map[string]string, error) {

// SetAnnotations sets the annotation pairs on the given entity.
// Currently annotations are supported on machines, services,
// units and the environment itself.
// units and the model itself.
// This API is now deprecated - "Annotations" client should be used instead.
// TODO(anastasiamac) remove for Juju 2.x
func (c *Client) SetAnnotations(tag string, pairs map[string]string) error {
Expand Down
8 changes: 4 additions & 4 deletions api/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,15 +493,15 @@ func (s *clientSuite) TestOpenUsesEnvironUUIDPaths(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
apistate.Close()

// Passing in the correct environment UUID should also work
// Passing in the correct model UUID should also work
environ, err := s.State.Model()
c.Assert(err, jc.ErrorIsNil)
info.ModelTag = environ.ModelTag()
apistate, err = api.Open(info, api.DialOpts{})
c.Assert(err, jc.ErrorIsNil)
apistate.Close()

// Passing in a bad environment UUID should fail with a known error
// Passing in a bad model UUID should fail with a known error
info.ModelTag = names.NewModelTag("dead-beef-123456")
apistate, err = api.Open(info, api.DialOpts{})
c.Check(err, gc.ErrorMatches, `unknown model: "dead-beef-123456"`)
Expand All @@ -513,12 +513,12 @@ func (s *clientSuite) TestSetEnvironAgentVersionDuringUpgrade(c *gc.C) {
// This is an integration test which ensure that a test with the
// correct error code is seen by the client from the
// SetModelAgentVersion call when an upgrade is in progress.
envConfig, err := s.State.EnvironConfig()
envConfig, err := s.State.ModelConfig()
c.Assert(err, jc.ErrorIsNil)
agentVersion, ok := envConfig.AgentVersion()
c.Assert(ok, jc.IsTrue)
machine := s.Factory.MakeMachine(c, &factory.MachineParams{
Jobs: []state.MachineJob{state.JobManageEnviron},
Jobs: []state.MachineJob{state.JobManageModel},
})
err = machine.SetAgentVersion(version.MustParseBinary(agentVersion.String() + "-quantal-amd64"))
c.Assert(err, jc.ErrorIsNil)
Expand Down
2 changes: 1 addition & 1 deletion api/common/apiaddresser.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (a *APIAddresser) APIAddresses() ([]string, error) {
return result.Result, nil
}

// ModelUUID returns the model UUID to connect to the environment
// ModelUUID returns the model UUID to connect to the model
// that the current connection is for.
func (a *APIAddresser) ModelUUID() (string, error) {
var result params.StringResult
Expand Down
48 changes: 0 additions & 48 deletions api/common/environwatcher.go

This file was deleted.

Loading

0 comments on commit f75f108

Please sign in to comment.