~fwereade/pyjuju/preflight-constraints

« back to all changes in this revision

Viewing changes to juju/state/service.py

  • Committer: William Reade
  • Date: 2012-04-04 15:39:01 UTC
  • mfrom: (494.1.18 trunk)
  • Revision ID: fwereade@gmail.com-20120404153901-aewisetre0zwgcus
finished tests, removed inappropriate preflighting

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    return base_constraints.with_series(series)
36
36
 
37
37
 
38
 
def _validate_service_constraints(client, constraints):
39
 
    # We don't store the final constraints -- service constraints are
40
 
    # dynamically combined with environment constraints at unit deploy
41
 
    # time -- but we do check what those constraints would be, in order
42
 
    # to block impossible deploys, or add-unit-breaking constraint settings,
43
 
    # before we actually write anything to zookeeper.
44
 
    esm = EnvironmentStateManager(client)
45
 
    final_constraints = yield esm.get_final_constraints(constraints.data)
46
 
    yield final_constraints.preflight()
47
 
 
48
 
 
49
38
class ServiceStateManager(StateBase):
50
39
    """Manages the state of services in an environment."""
51
40
 
61
50
        """
62
51
        charm_id = charm_state.id
63
52
        constraints = _series_constraints(constraints, charm_id)
64
 
        # TODO FWER test
65
 
        yield _validate_service_constraints(self._client, constraints)
66
 
 
67
53
        service_details = {
68
54
            "charm": charm_id, "constraints": constraints.data}
69
55
        # charm metadata is always decoded into unicode, ensure any
370
356
        """
371
357
        charm_id = yield self.get_charm_id()
372
358
        constraints = _series_constraints(constraints, charm_id)
373
 
        # TODO FWER test
374
 
        yield _validate_service_constraints(self._client, constraints)
375
359
        yield self._set_node_value("constraints", constraints.data)
376
360
 
377
361
    @inlineCallbacks