Merge lp:~fwereade/pyjuju/sync-env-when-required into lp:~fwereade/pyjuju/shadow-trunk-1204

Proposed by William Reade
Status: Merged
Approved by: William Reade
Approved revision: 521
Merged at revision: 515
Proposed branch: lp:~fwereade/pyjuju/sync-env-when-required
Merge into: lp:~fwereade/pyjuju/shadow-trunk-1204
Prerequisite: lp:~fwereade/pyjuju/warn-ignored-constraints
Diff against target: 0 lines
To merge this branch: bzr merge lp:~fwereade/pyjuju/sync-env-when-required
Reviewer Review Type Date Requested Status
William Reade Pending
Review via email: mp+99941@code.launchpad.net

Description of the change

All actions which require remote environment state now sync it

add-unit had lost it somewhere in the pipeline due to expectation of syncing
being retired; terminate-machine never had it; deploy and
[gs]et-constraints' tests slightly improved.

https://codereview.appspot.com/5957044/

To post a comment you must log in.
Revision history for this message
William Reade (fwereade) wrote :
Download full text (11.2 KiB)

Reviewers: mp+99941_code.launchpad.net,

Message:
Please take a look.

Description:
All actions which require remote environment state now sync it

add-unit had lost it somewhere in the pipeline due to expectation of
syncing
being retired; terminate-machine never had it; deploy and
[gs]et-constraints' tests slightly improved.

https://code.launchpad.net/~fwereade/juju/sync-env-when-required/+merge/99941

Requires:
https://code.launchpad.net/~fwereade/juju/warn-ignored-constraints/+merge/99861

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M juju/control/add_unit.py
   M juju/control/constraints_get.py
   M juju/control/constraints_set.py
   M juju/control/deploy.py
   M juju/control/terminate_machine.py
   M juju/control/tests/test_add_unit.py
   M juju/control/tests/test_constraints_get.py
   M juju/control/tests/test_constraints_set.py
   M juju/control/tests/test_terminate_machine.py
   M juju/control/utils.py

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: juju/control/add_unit.py
=== modified file 'juju/control/add_unit.py'
--- juju/control/add_unit.py 2012-03-26 13:26:58 +0000
+++ juju/control/add_unit.py 2012-03-29 13:40:45 +0000
@@ -3,7 +3,7 @@
  from twisted.internet.defer import inlineCallbacks

  from juju.control import legacy
-from juju.control.utils import get_environment
+from juju.control.utils import get_environment, sync_environment_state
  from juju.state.placement import place_unit
  from juju.state.service import ServiceStateManager

@@ -47,8 +47,8 @@
      try:
          yield legacy.check_environment(
              client, provider.get_legacy_config_keys())
+ yield sync_environment_state(client, config, environment.name)

- # TODO: handle legacy environment syncing?
          service_manager = ServiceStateManager(client)
          service_state = yield
service_manager.get_service_state(service_name)
          for i in range(num_units):

Index: juju/control/constraints_get.py
=== modified file 'juju/control/constraints_get.py'
--- juju/control/constraints_get.py 2012-03-29 02:00:04 +0000
+++ juju/control/constraints_get.py 2012-03-29 13:40:45 +0000
@@ -4,7 +4,7 @@

  from twisted.internet.defer import inlineCallbacks

-from juju.control.utils import get_environment
+from juju.control.utils import get_environment, sync_environment_state
  from juju.state.environment import EnvironmentStateManager
  from juju.state.machine import MachineStateManager
  from juju.state.service import ServiceStateManager
@@ -47,8 +47,7 @@
      client = yield provider.connect()
      result = {}
      try:
- esm = EnvironmentStateManager(client)
- yield esm.set_config_state(env_config, environment.name)
+ yield sync_environment_state(client, env_config, environment.name)
          if entity_names:
              msm = MachineStateMan...

Revision history for this message
William Reade (fwereade) wrote :
520. By William Reade

added explanatory docstring to sync_environment_state (rather than adding one at evry call site)

521. By William Reade

merge parent

Revision history for this message
Kapil Thangavelu (hazmat) wrote :

lgtm, centralizes all the env syncing across control.

https://codereview.appspot.com/5957044/diff/1012/juju/control/tests/test_constraints_get.py
File juju/control/tests/test_constraints_get.py (right):

https://codereview.appspot.com/5957044/diff/1012/juju/control/tests/test_constraints_get.py#newcode99
juju/control/tests/test_constraints_get.py:99: yield esm.get_config()
what is this bit verifying?

https://codereview.appspot.com/5957044/diff/1012/juju/control/utils.py
File juju/control/utils.py (right):

https://codereview.appspot.com/5957044/diff/1012/juju/control/utils.py#newcode38
juju/control/utils.py:38: that state code can use an
EnvironmentStateManager to get a provider.
thank you.. this is just what i was looking for in an earlier branch.

https://codereview.appspot.com/5957044/

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

https://codereview.appspot.com/5957044/diff/1012/juju/control/tests/test_constraints_get.py
File juju/control/tests/test_constraints_get.py (right):

https://codereview.appspot.com/5957044/diff/1012/juju/control/tests/test_constraints_get.py#newcode99
juju/control/tests/test_constraints_get.py:99: yield esm.get_config()
On 2012/03/29 21:04:03, hazmat wrote:
> what is this bit verifying?

It's actually redundant; I thought it would have a clarifying effect,
but clearly not. Commenting instead.

https://codereview.appspot.com/5957044/

522. By William Reade

merge parent

523. By William Reade

merge parent

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

*** Submitted:

All actions which require remote environment state now sync it

add-unit had lost it somewhere in the pipeline due to expectation of
syncing
being retired; terminate-machine never had it; deploy and
[gs]et-constraints' tests slightly improved.

R=hazmat
CC=
https://codereview.appspot.com/5957044

https://codereview.appspot.com/5957044/

Preview Diff

Empty

Subscribers

People subscribed via source and target branches

to all changes: