Merge lp:~rogpeppe/juju-core/453-maas-instance-uuid into lp:~go-bot/juju-core/trunk

Proposed by Roger Peppe
Status: Merged
Approved by: Roger Peppe
Approved revision: no longer in the source branch.
Merged at revision: 1990
Proposed branch: lp:~rogpeppe/juju-core/453-maas-instance-uuid
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 323 lines (+76/-57)
9 files modified
provider/maas/config.go (+12/-6)
provider/maas/config_test.go (+23/-7)
provider/maas/environ.go (+2/-2)
provider/maas/environ_test.go (+2/-2)
provider/maas/environprovider.go (+12/-15)
provider/maas/environprovider_test.go (+11/-11)
provider/maas/maas_test.go (+6/-6)
provider/maas/storage.go (+2/-2)
provider/maas/storage_test.go (+6/-6)
To merge this branch: bzr merge lp:~rogpeppe/juju-core/453-maas-instance-uuid
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+191367@code.launchpad.net

Commit message

provider/maas: do not use environ-uuid

As pointed out by fwereade, it could be
confusing to have two things in the system
that both purport to be a uuid for the environ.

Also make the MAAS EnvironProvider.Validate
check that we're not changing the maas-agent-name.

https://codereview.appspot.com/14741045/

Description of the change

provider/maas: do not use environ-uuid

As pointed out by fwereade, it could be
confusing to have two things in the system
that both purport to be a uuid for the environ.

Also make the MAAS EnvironProvider.Validate
check that we're not changing the maas-instance-uuid.

https://codereview.appspot.com/14741045/

To post a comment you must log in.
Revision history for this message
Roger Peppe (rogpeppe) wrote :
Download full text (7.9 KiB)

Reviewers: mp+191367_code.launchpad.net,

Message:
Please take a look.

Description:
provider/maas: do not use environ-uuid

As pointed out by fwereade, it could be
confusing to have two things in the system
that both purport to be a uuid for the environ.

Also make the MAAS EnvironProvider.Validate
check that we're not changing the maas-instance-uuid.

https://code.launchpad.net/~rogpeppe/juju-core/453-maas-instance-uuid/+merge/191367

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/14741045/

Affected files (+58, -37 lines):
   A [revision details]
   M provider/maas/config.go
   M provider/maas/config_test.go
   M provider/maas/environprovider.go
   M provider/maas/environprovider_test.go
   M provider/maas/maas_test.go
   M provider/maas/storage_test.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20131016061150-dqoy06taxa0edywm
+New revision: <email address hidden>

Index: provider/maas/config.go
=== modified file 'provider/maas/config.go'
--- provider/maas/config.go 2013-10-15 16:18:32 +0000
+++ provider/maas/config.go 2013-10-16 10:29:29 +0000
@@ -18,14 +18,14 @@
   // maas-oauth is a colon-separated triplet of:
   // consumer-key:resource-token:resource-secret
   "maas-oauth": schema.String(),
- // environment-uuid is an optional UUID to group the machines
+ // maas-instance-uuid is an optional UUID to group the instances
   // acquired from MAAS, to support multiple environments per MAAS user.
- "environment-uuid": schema.String(),
+ "maas-instance-uuid": schema.String(),
  }
  var configDefaults = schema.Defaults{
- // For backward-compatibility, environment-uuid is the empty string
+ // For backward-compatibility, maas-instance-uuid is the empty string
   // by default. However, new environments should all use a UUID.
- "environment-uuid": "",
+ "maas-instance-uuid": "",
  }

  type maasEnvironConfig struct {
@@ -42,7 +42,7 @@
  }

  func (cfg *maasEnvironConfig) maasEnvironmentUUID() string {
- if uuid, ok := cfg.attrs["environment-uuid"].(string); ok {
+ if uuid, ok := cfg.attrs["maas-instance-uuid"].(string); ok {
    return uuid
   }
   return ""
@@ -72,6 +72,12 @@
   if err != nil {
    return nil, err
   }
+ if oldCfg != nil {
+ oldAttrs := oldCfg.UnknownAttrs()
+ if validated["maas-instance-uuid"] != oldAttrs["maas-instance-uuid"] {
+ return nil, fmt.Errorf("cannot change maas-instance-uuid")
+ }
+ }
   envCfg := new(maasEnvironConfig)
   envCfg.Config = cfg
   envCfg.attrs = validated

Index: provider/maas/config_test.go
=== modified file 'provider/maas/config_test.go'
--- provider/maas/config_test.go 2013-10-15 16:52:58 +0000
+++ provider/maas/config_test.go 2013-10-16 10:42:01 +0000
@@ -47,10 +47,10 @@
   uuid, err := utils.NewUUID()
   c.Assert(err, gc.IsNil)
   ecfg, err := newConfig(map[string]interface{}{
- "maas-server": server,
- "maas-oauth": oauth,
- "environment-uuid": uuid.String(),
- "future-key": future,
+ "maas-server": server,
+ "ma...

Read more...

Revision history for this message
Martin Packman (gz) wrote :

LGTM. We will need to be careful when we fiddle with this mechanism in
future to make sure upgrades don't start using a new name for instances
as it needs to be stable across the lifetime of the environment.

https://codereview.appspot.com/14741045/

Revision history for this message
Nate Finch (natefinch) wrote :

LGTM, although I'd prefer if someone factored out all the magic strings.

https://codereview.appspot.com/14741045/

Revision history for this message
Roger Peppe (rogpeppe) wrote :
Revision history for this message
Roger Peppe (rogpeppe) wrote :
Revision history for this message
Raphaël Badin (rvb) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'provider/maas/config.go'
--- provider/maas/config.go 2013-10-15 16:18:32 +0000
+++ provider/maas/config.go 2013-10-16 12:45:44 +0000
@@ -18,14 +18,14 @@
18 // maas-oauth is a colon-separated triplet of:18 // maas-oauth is a colon-separated triplet of:
19 // consumer-key:resource-token:resource-secret19 // consumer-key:resource-token:resource-secret
20 "maas-oauth": schema.String(),20 "maas-oauth": schema.String(),
21 // environment-uuid is an optional UUID to group the machines21 // maas-agent-name is an optional UUID to group the instances
22 // acquired from MAAS, to support multiple environments per MAAS user.22 // acquired from MAAS, to support multiple environments per MAAS user.
23 "environment-uuid": schema.String(),23 "maas-agent-name": schema.String(),
24}24}
25var configDefaults = schema.Defaults{25var configDefaults = schema.Defaults{
26 // For backward-compatibility, environment-uuid is the empty string26 // For backward-compatibility, maas-agent-name is the empty string
27 // by default. However, new environments should all use a UUID.27 // by default. However, new environments should all use a UUID.
28 "environment-uuid": "",28 "maas-agent-name": "",
29}29}
3030
31type maasEnvironConfig struct {31type maasEnvironConfig struct {
@@ -41,8 +41,8 @@
41 return cfg.attrs["maas-oauth"].(string)41 return cfg.attrs["maas-oauth"].(string)
42}42}
4343
44func (cfg *maasEnvironConfig) maasEnvironmentUUID() string {44func (cfg *maasEnvironConfig) maasAgentName() string {
45 if uuid, ok := cfg.attrs["environment-uuid"].(string); ok {45 if uuid, ok := cfg.attrs["maas-agent-name"].(string); ok {
46 return uuid46 return uuid
47 }47 }
48 return ""48 return ""
@@ -72,6 +72,12 @@
72 if err != nil {72 if err != nil {
73 return nil, err73 return nil, err
74 }74 }
75 if oldCfg != nil {
76 oldAttrs := oldCfg.UnknownAttrs()
77 if validated["maas-agent-name"] != oldAttrs["maas-agent-name"] {
78 return nil, fmt.Errorf("cannot change maas-agent-name")
79 }
80 }
75 envCfg := new(maasEnvironConfig)81 envCfg := new(maasEnvironConfig)
76 envCfg.Config = cfg82 envCfg.Config = cfg
77 envCfg.attrs = validated83 envCfg.attrs = validated
7884
=== modified file 'provider/maas/config_test.go'
--- provider/maas/config_test.go 2013-10-15 16:52:58 +0000
+++ provider/maas/config_test.go 2013-10-16 12:45:44 +0000
@@ -47,25 +47,25 @@
47 uuid, err := utils.NewUUID()47 uuid, err := utils.NewUUID()
48 c.Assert(err, gc.IsNil)48 c.Assert(err, gc.IsNil)
49 ecfg, err := newConfig(map[string]interface{}{49 ecfg, err := newConfig(map[string]interface{}{
50 "maas-server": server,50 "maas-server": server,
51 "maas-oauth": oauth,51 "maas-oauth": oauth,
52 "environment-uuid": uuid.String(),52 "maas-agent-name": uuid.String(),
53 "future-key": future,53 "future-key": future,
54 })54 })
55 c.Assert(err, gc.IsNil)55 c.Assert(err, gc.IsNil)
56 c.Check(ecfg.maasServer(), gc.Equals, server)56 c.Check(ecfg.maasServer(), gc.Equals, server)
57 c.Check(ecfg.maasOAuth(), gc.DeepEquals, oauth)57 c.Check(ecfg.maasOAuth(), gc.DeepEquals, oauth)
58 c.Check(ecfg.maasEnvironmentUUID(), gc.Equals, uuid.String())58 c.Check(ecfg.maasAgentName(), gc.Equals, uuid.String())
59 c.Check(ecfg.UnknownAttrs()["future-key"], gc.DeepEquals, future)59 c.Check(ecfg.UnknownAttrs()["future-key"], gc.DeepEquals, future)
60}60}
6161
62func (*configSuite) TestEnvironmentUUIDDefault(c *gc.C) {62func (*configSuite) TestMaasAgentNameDefault(c *gc.C) {
63 ecfg, err := newConfig(map[string]interface{}{63 ecfg, err := newConfig(map[string]interface{}{
64 "maas-server": "http://maas.testing.invalid/maas/",64 "maas-server": "http://maas.testing.invalid/maas/",
65 "maas-oauth": "consumer-key:resource-token:resource-secret",65 "maas-oauth": "consumer-key:resource-token:resource-secret",
66 })66 })
67 c.Assert(err, gc.IsNil)67 c.Assert(err, gc.IsNil)
68 c.Check(ecfg.maasEnvironmentUUID(), gc.Equals, "")68 c.Check(ecfg.maasAgentName(), gc.Equals, "")
69}69}
7070
71func (*configSuite) TestChecksWellFormedMaasServer(c *gc.C) {71func (*configSuite) TestChecksWellFormedMaasServer(c *gc.C) {
@@ -105,3 +105,19 @@
105 c.Assert(err, gc.NotNil)105 c.Assert(err, gc.NotNil)
106 c.Check(err, gc.ErrorMatches, ".*cannot change name.*")106 c.Check(err, gc.ErrorMatches, ".*cannot change name.*")
107}107}
108
109func (*configSuite) TestValidateCannotChangeAgentName(c *gc.C) {
110 baseAttrs := map[string]interface{}{
111 "maas-server": "http://maas.testing.invalid/maas/",
112 "maas-oauth": "consumer-key:resource-token:resource-secret",
113 "maas-agent-name": "1234-5678",
114 }
115 oldCfg, err := newConfig(baseAttrs)
116 c.Assert(err, gc.IsNil)
117 newCfg, err := oldCfg.Apply(map[string]interface{}{
118 "maas-agent-name": "9876-5432",
119 })
120 c.Assert(err, gc.IsNil)
121 _, err = maasEnvironProvider{}.Validate(newCfg, oldCfg.Config)
122 c.Assert(err, gc.ErrorMatches, "cannot change maas-agent-name")
123}
108124
=== modified file 'provider/maas/environ.go'
--- provider/maas/environ.go 2013-10-15 16:09:23 +0000
+++ provider/maas/environ.go 2013-10-16 12:45:44 +0000
@@ -171,7 +171,7 @@
171// acquireNode allocates a node from the MAAS.171// acquireNode allocates a node from the MAAS.
172func (environ *maasEnviron) acquireNode(cons constraints.Value, possibleTools tools.List) (gomaasapi.MAASObject, *tools.Tools, error) {172func (environ *maasEnviron) acquireNode(cons constraints.Value, possibleTools tools.List) (gomaasapi.MAASObject, *tools.Tools, error) {
173 acquireParams := convertConstraints(cons)173 acquireParams := convertConstraints(cons)
174 acquireParams.Add("agent_name", environ.ecfg().maasEnvironmentUUID())174 acquireParams.Add("agent_name", environ.ecfg().maasAgentName())
175 var result gomaasapi.JSONObject175 var result gomaasapi.JSONObject
176 var err error176 var err error
177 for a := shortAttempt.Start(); a.Next(); {177 for a := shortAttempt.Start(); a.Next(); {
@@ -323,7 +323,7 @@
323func (environ *maasEnviron) instances(ids []instance.Id) ([]instance.Instance, error) {323func (environ *maasEnviron) instances(ids []instance.Id) ([]instance.Instance, error) {
324 nodeListing := environ.getMAASClient().GetSubObject("nodes")324 nodeListing := environ.getMAASClient().GetSubObject("nodes")
325 filter := getSystemIdValues(ids)325 filter := getSystemIdValues(ids)
326 filter.Add("agent_name", environ.ecfg().maasEnvironmentUUID())326 filter.Add("agent_name", environ.ecfg().maasAgentName())
327 listNodeObjects, err := nodeListing.CallGet("list", filter)327 listNodeObjects, err := nodeListing.CallGet("list", filter)
328 if err != nil {328 if err != nil {
329 return nil, err329 return nil, err
330330
=== modified file 'provider/maas/environ_test.go'
--- provider/maas/environ_test.go 2013-10-16 05:21:12 +0000
+++ provider/maas/environ_test.go 2013-10-16 12:45:44 +0000
@@ -310,7 +310,7 @@
310 c.Assert(nodeRequestValues[0].Get("mem"), gc.Equals, "1024")310 c.Assert(nodeRequestValues[0].Get("mem"), gc.Equals, "1024")
311}311}
312312
313func (suite *environSuite) TestAcquireNodePassedEnvironmentUUID(c *gc.C) {313func (suite *environSuite) TestAcquireNodePassedAgentName(c *gc.C) {
314 stor := NewStorage(suite.makeEnviron())314 stor := NewStorage(suite.makeEnviron())
315 fakeTools := envtesting.MustUploadFakeToolsVersions(stor, version.Current)[0]315 fakeTools := envtesting.MustUploadFakeToolsVersions(stor, version.Current)[0]
316 env := suite.makeEnviron()316 env := suite.makeEnviron()
@@ -322,7 +322,7 @@
322 requestValues := suite.testMAASObject.TestServer.NodeOperationRequestValues()322 requestValues := suite.testMAASObject.TestServer.NodeOperationRequestValues()
323 nodeRequestValues, found := requestValues["node0"]323 nodeRequestValues, found := requestValues["node0"]
324 c.Assert(found, gc.Equals, true)324 c.Assert(found, gc.Equals, true)
325 c.Assert(nodeRequestValues[0].Get("agent_name"), gc.Equals, exampleUUID)325 c.Assert(nodeRequestValues[0].Get("agent_name"), gc.Equals, exampleAgentName)
326}326}
327327
328func (*environSuite) TestConvertConstraints(c *gc.C) {328func (*environSuite) TestConvertConstraints(c *gc.C) {
329329
=== modified file 'provider/maas/environprovider.go'
--- provider/maas/environprovider.go 2013-10-15 16:36:59 +0000
+++ provider/maas/environprovider.go 2013-10-16 12:45:44 +0000
@@ -38,24 +38,21 @@
38 return env, nil38 return env, nil
39}39}
4040
41var errUUIDAlreadySet = errors.New(41var errAgentNameAlreadySet = errors.New(
42 "environment-uuid is already set; this should not be set by hand")42 "maas-agent-name is already set; this should not be set by hand")
4343
44func (p maasEnvironProvider) Prepare(cfg *config.Config) (environs.Environ, error) {44func (p maasEnvironProvider) Prepare(cfg *config.Config) (environs.Environ, error) {
45 attrs := cfg.UnknownAttrs()45 attrs := cfg.UnknownAttrs()
46 uuid, found := attrs["environment-uuid"]46 oldName, found := attrs["maas-agent-name"]
47 if found {47 if found && oldName != "" {
48 if uuid != "" {48 return nil, errAgentNameAlreadySet
49 return nil, errUUIDAlreadySet49 }
50 }50 uuid, err := utils.NewUUID()
51 } else {51 if err != nil {
52 uuid, err := utils.NewUUID()52 return nil, err
53 if err != nil {53 }
54 return nil, err54 attrs["maas-agent-name"] = uuid.String()
55 }55 cfg, err = cfg.Apply(attrs)
56 attrs["environment-uuid"] = uuid.String()
57 }
58 cfg, err := cfg.Apply(attrs)
59 if err != nil {56 if err != nil {
60 return nil, err57 return nil, err
61 }58 }
6259
=== modified file 'provider/maas/environprovider_test.go'
--- provider/maas/environprovider_test.go 2013-10-15 16:36:59 +0000
+++ provider/maas/environprovider_test.go 2013-10-16 12:45:44 +0000
@@ -11,6 +11,7 @@
1111
12 "launchpad.net/juju-core/environs/config"12 "launchpad.net/juju-core/environs/config"
13 "launchpad.net/juju-core/testing"13 "launchpad.net/juju-core/testing"
14 jc "launchpad.net/juju-core/testing/checkers"
14 "launchpad.net/juju-core/utils"15 "launchpad.net/juju-core/utils"
15)16)
1617
@@ -39,7 +40,7 @@
39 c.Check(secretAttrs, gc.DeepEquals, expectedAttrs)40 c.Check(secretAttrs, gc.DeepEquals, expectedAttrs)
40}41}
4142
42func (suite *EnvironProviderSuite) TestUnknownAttrsContainEnvironmentUUID(c *gc.C) {43func (suite *EnvironProviderSuite) TestUnknownAttrsContainAgentName(c *gc.C) {
43 testJujuHome := c.MkDir()44 testJujuHome := c.MkDir()
44 defer config.SetJujuHome(config.SetJujuHome(testJujuHome))45 defer config.SetJujuHome(config.SetJujuHome(testJujuHome))
45 attrs := testing.FakeConfig().Merge(testing.Attrs{46 attrs := testing.FakeConfig().Merge(testing.Attrs{
@@ -56,27 +57,26 @@
56 preparedConfig := environ.Config()57 preparedConfig := environ.Config()
57 unknownAttrs := preparedConfig.UnknownAttrs()58 unknownAttrs := preparedConfig.UnknownAttrs()
5859
59 uuid, ok := unknownAttrs["environment-uuid"]60 uuid, ok := unknownAttrs["maas-agent-name"]
60 c.Assert(ok, gc.Equals, true)
6161
62 _, err = utils.UUIDFromString(uuid.(string))62 c.Assert(ok, jc.IsTrue)
63 c.Assert(err, gc.IsNil)63 c.Assert(uuid, jc.Satisfies, utils.IsValidUUIDString)
64}64}
6565
66func (suite *EnvironProviderSuite) TestEnvironmentUUIDShouldNotBeSetByHand(c *gc.C) {66func (suite *EnvironProviderSuite) TestAgentNameShouldNotBeSetByHand(c *gc.C) {
67 testJujuHome := c.MkDir()67 testJujuHome := c.MkDir()
68 defer config.SetJujuHome(config.SetJujuHome(testJujuHome))68 defer config.SetJujuHome(config.SetJujuHome(testJujuHome))
69 attrs := testing.FakeConfig().Merge(testing.Attrs{69 attrs := testing.FakeConfig().Merge(testing.Attrs{
70 "type": "maas",70 "type": "maas",
71 "maas-oauth": "aa:bb:cc",71 "maas-oauth": "aa:bb:cc",
72 "maas-server": "http://maas.testing.invalid/maas/",72 "maas-server": "http://maas.testing.invalid/maas/",
73 "environment-uuid": "foobar",73 "maas-agent-name": "foobar",
74 })74 })
75 config, err := config.New(config.NoDefaults, attrs)75 config, err := config.New(config.NoDefaults, attrs)
76 c.Assert(err, gc.IsNil)76 c.Assert(err, gc.IsNil)
7777
78 _, err = suite.makeEnviron().Provider().Prepare(config)78 _, err = suite.makeEnviron().Provider().Prepare(config)
79 c.Assert(err, gc.Equals, errUUIDAlreadySet)79 c.Assert(err, gc.Equals, errAgentNameAlreadySet)
80}80}
8181
82// create a temporary file with the given content. The file will be cleaned82// create a temporary file with the given content. The file will be cleaned
8383
=== modified file 'provider/maas/maas_test.go'
--- provider/maas/maas_test.go 2013-10-15 16:52:58 +0000
+++ provider/maas/maas_test.go 2013-10-16 12:45:44 +0000
@@ -52,16 +52,16 @@
52 s.LoggingSuite.TearDownSuite(c)52 s.LoggingSuite.TearDownSuite(c)
53}53}
5454
55const exampleUUID = "dfb69555-0bc4-4d1f-85f2-4ee390974984"55const exampleAgentName = "dfb69555-0bc4-4d1f-85f2-4ee390974984"
5656
57// makeEnviron creates a functional maasEnviron for a test.57// makeEnviron creates a functional maasEnviron for a test.
58func (suite *providerSuite) makeEnviron() *maasEnviron {58func (suite *providerSuite) makeEnviron() *maasEnviron {
59 attrs := coretesting.FakeConfig().Merge(coretesting.Attrs{59 attrs := coretesting.FakeConfig().Merge(coretesting.Attrs{
60 "name": "test env",60 "name": "test env",
61 "type": "maas",61 "type": "maas",
62 "maas-oauth": "a:b:c",62 "maas-oauth": "a:b:c",
63 "maas-server": suite.testMAASObject.TestServer.URL,63 "maas-server": suite.testMAASObject.TestServer.URL,
64 "environment-uuid": exampleUUID,64 "maas-agent-name": exampleAgentName,
65 })65 })
66 cfg, err := config.New(config.NoDefaults, attrs)66 cfg, err := config.New(config.NoDefaults, attrs)
67 if err != nil {67 if err != nil {
6868
=== modified file 'provider/maas/storage.go'
--- provider/maas/storage.go 2013-10-16 05:21:12 +0000
+++ provider/maas/storage.go 2013-10-16 12:45:44 +0000
@@ -91,10 +91,10 @@
9191
92// All filenames need to be namespaced so they are private to this environment.92// All filenames need to be namespaced so they are private to this environment.
93// This prevents different environments from interfering with each other.93// This prevents different environments from interfering with each other.
94// We're using the environment's UUID here.94// We're using the agent name UUID here.
95func (stor *maasStorage) prefixWithPrivateNamespace(name string) string {95func (stor *maasStorage) prefixWithPrivateNamespace(name string) string {
96 env := stor.getSnapshot().environUnlocked96 env := stor.getSnapshot().environUnlocked
97 prefix := env.ecfg().maasEnvironmentUUID()97 prefix := env.ecfg().maasAgentName()
98 if prefix != "" {98 if prefix != "" {
99 return prefix + "-" + name99 return prefix + "-" + name
100 }100 }
101101
=== modified file 'provider/maas/storage_test.go'
--- provider/maas/storage_test.go 2013-10-16 05:21:12 +0000
+++ provider/maas/storage_test.go 2013-10-16 12:45:44 +0000
@@ -398,22 +398,22 @@
398 c.Assert(listing, gc.DeepEquals, []string{})398 c.Assert(listing, gc.DeepEquals, []string{})
399}399}
400400
401func (s *storageSuite) TestprefixWithPrivateNamespacePrefixesWithUUID(c *gc.C) {401func (s *storageSuite) TestprefixWithPrivateNamespacePrefixesWithAgentName(c *gc.C) {
402 sstor := NewStorage(s.makeEnviron())402 sstor := NewStorage(s.makeEnviron())
403 stor := sstor.(*maasStorage)403 stor := sstor.(*maasStorage)
404 uuid := stor.environUnlocked.ecfg().maasEnvironmentUUID()404 agentName := stor.environUnlocked.ecfg().maasAgentName()
405 c.Assert(uuid, gc.Not(gc.Equals), "")405 c.Assert(agentName, gc.Not(gc.Equals), "")
406 expectedPrefix := uuid + "-"406 expectedPrefix := agentName + "-"
407 const name = "myname"407 const name = "myname"
408 expectedResult := expectedPrefix + name408 expectedResult := expectedPrefix + name
409 c.Assert(stor.prefixWithPrivateNamespace(name), gc.Equals, expectedResult)409 c.Assert(stor.prefixWithPrivateNamespace(name), gc.Equals, expectedResult)
410}410}
411411
412func (s *storageSuite) TesttprefixWithPrivateNamespaceIgnoresEmptyUUID(c *gc.C) {412func (s *storageSuite) TesttprefixWithPrivateNamespaceIgnoresAgentName(c *gc.C) {
413 sstor := NewStorage(s.makeEnviron())413 sstor := NewStorage(s.makeEnviron())
414 stor := sstor.(*maasStorage)414 stor := sstor.(*maasStorage)
415 ecfg := stor.environUnlocked.ecfg()415 ecfg := stor.environUnlocked.ecfg()
416 ecfg.attrs["environment-uuid"] = ""416 ecfg.attrs["maas-agent-name"] = ""
417417
418 const name = "myname"418 const name = "myname"
419 c.Assert(stor.prefixWithPrivateNamespace(name), gc.Equals, name)419 c.Assert(stor.prefixWithPrivateNamespace(name), gc.Equals, name)

Subscribers

People subscribed via source and target branches

to status/vote changes: