Merge lp:~niemeyer/pyjuju/go-state-environconfig into lp:pyjuju/go

Proposed by Gustavo Niemeyer
Status: Merged
Merged at revision: 209
Proposed branch: lp:~niemeyer/pyjuju/go-state-environconfig
Merge into: lp:pyjuju/go
Diff against target: 70 lines (+10/-10)
3 files modified
cmd/jujud/provisioning_test.go (+6/-6)
state/state.go (+2/-2)
state/state_test.go (+2/-2)
To merge this branch: bzr merge lp:~niemeyer/pyjuju/go-state-environconfig
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+108935@code.launchpad.net

Description of the change

state: rename Environment method to EnvironConfig

https://codereview.appspot.com/6295048/

To post a comment you must log in.
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :
Download full text (3.2 KiB)

Reviewers: mp+108935_code.launchpad.net,

Message:
Please take a look.

Description:
state: rename Environment method to EnvironConfig

https://code.launchpad.net/~niemeyer/juju/go-state-environconfig/+merge/108935

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M cmd/jujud/provisioning_test.go
   M state/state.go
   M state/state_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: <email address hidden>
+New revision: <email address hidden>

Index: state/state.go
=== modified file 'state/state.go'
--- state/state.go 2012-06-05 21:31:50 +0000
+++ state/state.go 2012-06-06 12:42:15 +0000
@@ -74,8 +74,8 @@
   return newConfigWatcher(s, zkEnvironmentPath)
  }

-// Environment returns the current configuration of the environment.
-func (s *State) Environment() (*ConfigNode, error) {
+// EnvironConfig returns the current configuration of the environment.
+func (s *State) EnvironConfig() (*ConfigNode, error) {
   return readConfigNode(s.zk, zkEnvironmentPath)
  }

Index: state/state_test.go
=== modified file 'state/state_test.go'
--- state/state_test.go 2012-06-06 10:17:40 +0000
+++ state/state_test.go 2012-06-06 12:42:15 +0000
@@ -1159,12 +1159,12 @@
   c.Assert(err, ErrorMatches, `can't add relations between 3 services`)
  }

-func (s *StateSuite) TestEnvironment(c *C) {
+func (s *StateSuite) TestEnvironConfig(c *C) {
   path, err := s.zkConn.Create("/environment", "type: dummy\nname: foo\n",
0, zookeeper.WorldACL(zookeeper.PERM_ALL))
   c.Assert(err, IsNil)
   c.Assert(path, Equals, "/environment")

- env, err := s.st.Environment()
+ env, err := s.st.EnvironConfig()
   env.Read()
   c.Assert(err, IsNil)
   c.Assert(env.Map(), DeepEquals,
map[string]interface{}{"type": "dummy", "name": "foo"})

Index: cmd/jujud/provisioning_test.go
=== modified file 'cmd/jujud/provisioning_test.go'
--- cmd/jujud/provisioning_test.go 2012-06-05 07:57:23 +0000
+++ cmd/jujud/provisioning_test.go 2012-06-06 12:42:15 +0000
@@ -67,8 +67,8 @@
  func (s *ProvisioningSuite) TestProvisionerEnvironmentChange(c *C) {
   p := NewProvisioner(s.st)

- // seed /environment to point to dummy
- env, err := s.st.Environment()
+ // Change environment configuration to point to dummy.
+ env, err := s.st.EnvironConfig()
   c.Assert(err, IsNil)
   env.Set("type", "dummy")
   env.Set("zookeeper", false)
@@ -76,8 +76,8 @@
   _, err = env.Write()
   c.Assert(err, IsNil)

- // twiddle with the environment
- env, err = s.st.Environment()
+ // Twiddle with the environment configuration.
+ env, err = s.st.EnvironConfig()
   c.Assert(err, IsNil)
   env.Set("name", "testing2")
   _, err = env.Write()
@@ -90,8 +90,8 @@
  func (s *ProvisioningSuite) TestProvisionerStopOnStateClose(c *C) {
   p := NewProvisioner(s.st)

- // seed /environment to point to dummy
- env, err := s.st.Environment()
+ // Change environment configuration to point to dummy.
+ env, err := s.st.EnvironConfig...

Read more...

Revision history for this message
Dave Cheney (dave-cheney) wrote :
Download full text (3.8 KiB)

LGTM.

On 06/06/2012, at 23:13, Gustavo Niemeyer <email address hidden> wrote:

> Reviewers: mp+108935_code.launchpad.net,
>
> Message:
> Please take a look.
>
> Description:
> state: rename Environment method to EnvironConfig
>
>
>
> https://code.launchpad.net/~niemeyer/juju/go-state-environconfig/+merge/108935
>
> (do not edit description out of merge proposal)
>
>
> Please review this at https://codereview.appspot.com/6295048/
>
> Affected files:
> A [revision details]
> M cmd/jujud/provisioning_test.go
> M state/state.go
> M state/state_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: <email address hidden>
> +New revision: <email address hidden>
>
> Index: state/state.go
> === modified file 'state/state.go'
> --- state/state.go 2012-06-05 21:31:50 +0000
> +++ state/state.go 2012-06-06 12:42:15 +0000
> @@ -74,8 +74,8 @@
> return newConfigWatcher(s, zkEnvironmentPath)
> }
>
> -// Environment returns the current configuration of the environment.
> -func (s *State) Environment() (*ConfigNode, error) {
> +// EnvironConfig returns the current configuration of the environment.
> +func (s *State) EnvironConfig() (*ConfigNode, error) {
> return readConfigNode(s.zk, zkEnvironmentPath)
> }
>
>
>
> Index: state/state_test.go
> === modified file 'state/state_test.go'
> --- state/state_test.go 2012-06-06 10:17:40 +0000
> +++ state/state_test.go 2012-06-06 12:42:15 +0000
> @@ -1159,12 +1159,12 @@
> c.Assert(err, ErrorMatches, `can't add relations between 3 services`)
> }
>
> -func (s *StateSuite) TestEnvironment(c *C) {
> +func (s *StateSuite) TestEnvironConfig(c *C) {
> path, err := s.zkConn.Create("/environment", "type: dummy\nname: foo\n",
> 0, zookeeper.WorldACL(zookeeper.PERM_ALL))
> c.Assert(err, IsNil)
> c.Assert(path, Equals, "/environment")
>
> - env, err := s.st.Environment()
> + env, err := s.st.EnvironConfig()
> env.Read()
> c.Assert(err, IsNil)
> c.Assert(env.Map(), DeepEquals,
> map[string]interface{}{"type": "dummy", "name": "foo"})
>
>
> Index: cmd/jujud/provisioning_test.go
> === modified file 'cmd/jujud/provisioning_test.go'
> --- cmd/jujud/provisioning_test.go 2012-06-05 07:57:23 +0000
> +++ cmd/jujud/provisioning_test.go 2012-06-06 12:42:15 +0000
> @@ -67,8 +67,8 @@
> func (s *ProvisioningSuite) TestProvisionerEnvironmentChange(c *C) {
> p := NewProvisioner(s.st)
>
> - // seed /environment to point to dummy
> - env, err := s.st.Environment()
> + // Change environment configuration to point to dummy.
> + env, err := s.st.EnvironConfig()
> c.Assert(err, IsNil)
> env.Set("type", "dummy")
> env.Set("zookeeper", false)
> @@ -76,8 +76,8 @@
> _, err = env.Write()
> c.Assert(err, IsNil)
>
> - // twiddle with the environment
> - env, err = s.st.Environment()
> + // Twiddle with the environment configuration.
> + env, err = s.st.EnvironConfig()
> c.Asse...

Read more...

207. By Frank Mueller

state: Added the method RemoveRelation() to State.

Relation is now an interface defining the single
method relationKey() to allow a function signature
like today in Python. The implementation is now
named relation and can be accessed via type
assertion.

R=niemeyer
CC=
https://codereview.appspot.com/6250076

208. By William Reade

subordinate service units can now be added to principal service units

This entails the following changes:

* new Service.AddUnitSubordinateTo method, which requires a principal unit
* topology.AddUnit now takes an additional principalKey string argument,
  which will be empty for a principal unit;
* new topology.UnitPrincipalKey, which returns the principal unit key for a
  subordinate unit or an error for a principal unit;
* new Unit.IsPrincipal method, which returns whether the unit is a principal
  unit;
* checks to prevent subordinate units being assigned directly to machines.

Most of the diff lines are a result of the change to topology.AddUnit;
sorry for the noise.

R=TheMue, niemeyer
CC=
https://codereview.appspot.com/6268050

Revision history for this message
William Reade (fwereade) wrote :
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

*** Submitted:

state: rename Environment method to EnvironConfig

R=TheMue, fwereade
CC=
https://codereview.appspot.com/6295048

https://codereview.appspot.com/6295048/

209. By Gustavo Niemeyer

state: rename Environment method to EnvironConfig

R=TheMue, fwereade
CC=
https://codereview.appspot.com/6295048

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmd/jujud/provisioning_test.go'
2--- cmd/jujud/provisioning_test.go 2012-06-05 07:57:23 +0000
3+++ cmd/jujud/provisioning_test.go 2012-06-06 13:10:09 +0000
4@@ -67,8 +67,8 @@
5 func (s *ProvisioningSuite) TestProvisionerEnvironmentChange(c *C) {
6 p := NewProvisioner(s.st)
7
8- // seed /environment to point to dummy
9- env, err := s.st.Environment()
10+ // Change environment configuration to point to dummy.
11+ env, err := s.st.EnvironConfig()
12 c.Assert(err, IsNil)
13 env.Set("type", "dummy")
14 env.Set("zookeeper", false)
15@@ -76,8 +76,8 @@
16 _, err = env.Write()
17 c.Assert(err, IsNil)
18
19- // twiddle with the environment
20- env, err = s.st.Environment()
21+ // Twiddle with the environment configuration.
22+ env, err = s.st.EnvironConfig()
23 c.Assert(err, IsNil)
24 env.Set("name", "testing2")
25 _, err = env.Write()
26@@ -90,8 +90,8 @@
27 func (s *ProvisioningSuite) TestProvisionerStopOnStateClose(c *C) {
28 p := NewProvisioner(s.st)
29
30- // seed /environment to point to dummy
31- env, err := s.st.Environment()
32+ // Change environment configuration to point to dummy.
33+ env, err := s.st.EnvironConfig()
34 c.Assert(err, IsNil)
35 env.Set("type", "dummy")
36 env.Set("zookeeper", false)
37
38=== modified file 'state/state.go'
39--- state/state.go 2012-06-05 21:31:50 +0000
40+++ state/state.go 2012-06-06 13:10:09 +0000
41@@ -74,8 +74,8 @@
42 return newConfigWatcher(s, zkEnvironmentPath)
43 }
44
45-// Environment returns the current configuration of the environment.
46-func (s *State) Environment() (*ConfigNode, error) {
47+// EnvironConfig returns the current configuration of the environment.
48+func (s *State) EnvironConfig() (*ConfigNode, error) {
49 return readConfigNode(s.zk, zkEnvironmentPath)
50 }
51
52
53=== modified file 'state/state_test.go'
54--- state/state_test.go 2012-06-06 10:17:40 +0000
55+++ state/state_test.go 2012-06-06 13:10:09 +0000
56@@ -1159,12 +1159,12 @@
57 c.Assert(err, ErrorMatches, `can't add relations between 3 services`)
58 }
59
60-func (s *StateSuite) TestEnvironment(c *C) {
61+func (s *StateSuite) TestEnvironConfig(c *C) {
62 path, err := s.zkConn.Create("/environment", "type: dummy\nname: foo\n", 0, zookeeper.WorldACL(zookeeper.PERM_ALL))
63 c.Assert(err, IsNil)
64 c.Assert(path, Equals, "/environment")
65
66- env, err := s.st.Environment()
67+ env, err := s.st.EnvironConfig()
68 env.Read()
69 c.Assert(err, IsNil)
70 c.Assert(env.Map(), DeepEquals, map[string]interface{}{"type": "dummy", "name": "foo"})

Subscribers

People subscribed via source and target branches