Ejemplo n.º 1
0
    def setUp(self):
        yield super(UnitContainerDeploymentTest, self).setUp()
        self.juju_home = self.makeDir()
        # Setup unit namespace
        environ = dict(os.environ)
        environ["JUJU_UNIT_NS"] = "ns1"
        self.change_environment(**environ)

        self.unit_deploy = UnitContainerDeployment(self.unit_name,
                                                   self.juju_home)
        self.charm = get_charm_from_path(self.sample_dir1)
        self.bundle = self.charm.as_bundle()
        self.output = self.capture_logging("unit.deploy", level=logging.DEBUG)
Ejemplo n.º 2
0
    def test_origin_usage(self):
        """The machine agent is started with a origin environment variable
        """
        mock_container = self.mocker.patch(LXCContainer)
        mock_container.is_constructed()
        self.mocker.result(True)
        mock_container.is_constructed()
        self.mocker.result(True)
        self.mocker.replay()

        environ = dict(os.environ)
        environ["JUJU_ORIGIN"] = "lp:~juju/foobar"

        self.change_environment(**environ)
        unit_deploy = UnitContainerDeployment(self.unit_name, self.juju_home)
        container = yield unit_deploy._get_master_template(
            "local", "127.0.0.1:1", "abc")
        self.assertEqual(container.origin, "lp:~juju/foobar")
        self.assertEqual(
            container.customize_log,
            os.path.join(self.juju_home, "units", "master-customize.log"))