示例#1
0
    def setUp(self):
        yield super(ControlResolvedTest, self).setUp()
        config = {"environments": {"firstenv": {"type": "dummy"}}}

        self.write_config(dump(config))
        self.config.load()

        yield self.add_relation_state("wordpress", "mysql")
        yield self.add_relation_state("wordpress", "varnish")

        self.service1 = yield self.service_state_manager.get_service_state(
            "mysql")
        self.service_unit1 = yield self.service1.add_unit_state()
        self.service_unit2 = yield self.service1.add_unit_state()

        self.unit1_workflow = UnitWorkflowState(self.client,
                                                self.service_unit1, None,
                                                self.makeDir())
        yield self.unit1_workflow.set_state("started")

        self.environment = self.config.get_default()
        self.provider = self.environment.get_machine_provider()

        self.output = self.capture_logging()
        self.stderr = self.capture_stream("stderr")
        self.executor = HookExecutor()
示例#2
0
    def configure(self, options):
        """Configure the unit agent."""
        super(UnitAgent, self).configure(options)
        if not options.get("unit_name"):
            msg = ("--unit-name must be provided in the command line, "
                   "or $JUJU_UNIT_NAME in the environment")
            raise JujuError(msg)
        self.executor = HookExecutor()

        self.api_factory = UnitSettingsFactory(
            self.executor.get_hook_context, logging.getLogger("unit.hook.api"))
        self.api_socket = None
        self.workflow = None
示例#3
0
    def setUp(self):
        yield super(LifecycleTestBase, self).setUp()

        if self.juju_directory is None:
            self.juju_directory = self.makeDir()

        self.hook_log = self.capture_logging("hook.output",
                                             level=logging.DEBUG)
        self.agent_log = self.capture_logging("unit-agent",
                                              level=logging.DEBUG)
        self.executor = HookExecutor()
        self.executor.start()
        self.change_environment(PATH=os.environ["PATH"],
                                JUJU_UNIT_NAME="service-unit/0")
示例#4
0
 def setUp(self):
     self._executor = HookExecutor()
     self.output = self.capture_logging("hook.executor", logging.DEBUG)