Пример #1
0
    def get_unit_relation_workflow(self, states):
        state_dir = os.path.join(self.juju_directory, "state")
        lifecycle = UnitRelationLifecycle(
            self.client, states["unit_relation"],
            states["service_relation"].relation_name, self.unit_directory,
            self.executor)

        workflow = RelationWorkflowState(self.client, states["unit_relation"],
                                         lifecycle, state_dir)

        return (workflow, lifecycle)
Пример #2
0
    def _get_unit_relation_workflow(self, unit_relation, service_relation):

        lifecycle = UnitRelationLifecycle(self._client, self._unit.unit_name,
                                          unit_relation,
                                          service_relation.relation_name,
                                          self._get_unit_path(),
                                          self._executor)

        state_directory = os.path.abspath(
            os.path.join(self._unit_path, "../../state"))

        workflow = RelationWorkflowState(self._client, unit_relation,
                                         lifecycle, state_directory)

        return workflow
Пример #3
0
 def setup_unit_relations(self, service_relation, *units):
     """
     Given a service relation and set of unit tuples in the form
     unit_state, unit_relation_workflow_state, will add unit relations
     for these units and update their workflow state to the desired/given
     state.
     """
     for unit, state in units:
         unit_relation = yield service_relation.add_unit_state(unit)
         lifecycle = UnitRelationLifecycle(self.client, unit.unit_name,
                                           unit_relation,
                                           service_relation.relation_name,
                                           self.makeDir(), self.executor)
         workflow_state = RelationWorkflowState(self.client, unit_relation,
                                                lifecycle, self.makeDir())
         yield workflow_state.set_state(state)
Пример #4
0
    def setUp(self):
        yield super(UnitRelationWorkflowTest, self).setUp()
        yield self.setup_default_test_relation()
        self.relation_name = self.states["service_relation"].relation_name
        self.juju_directory = self.makeDir()
        self.log_stream = self.capture_logging("unit.relation.lifecycle",
                                               logging.DEBUG)

        self.lifecycle = UnitRelationLifecycle(self.client,
                                               self.states["unit"].unit_name,
                                               self.states["unit_relation"],
                                               self.relation_name,
                                               self.unit_directory,
                                               self.executor)

        self.state_directory = self.makeDir(
            path=os.path.join(self.juju_directory, "state"))

        self.workflow = RelationWorkflowState(self.client,
                                              self.states["unit_relation"],
                                              self.lifecycle,
                                              self.state_directory)