Example #1
0
    def _get_master_template(self, machine_id, zookeeper_hosts, public_key):
        container_template_name = "%s-%s-template" % (
            self._unit_namespace, machine_id)

        master_template = LXCContainer(
            container_template_name, origin=self._juju_origin,
            public_key=public_key)

        # Debug log for the customize script, customize is only run on master.
        customize_log_path = os.path.join(
            self.juju_home, "units", "master-customize.log")
        master_template.customize_log = customize_log_path

        if not master_template.is_constructed():
            log.debug("Creating master container...")
            yield master_template.create()
            log.debug("Created master container %s" % container_template_name)

        # it wasn't constructed and we couldn't construct it
        if not master_template.is_constructed():
            raise LXCError("Unable to create master container")

        returnValue(master_template)
Example #2
0
    def _get_master_template(self, machine_id, zookeeper_hosts, public_key):
        container_template_name = "%s-%s-template" % (self._unit_namespace,
                                                      machine_id)

        master_template = LXCContainer(container_template_name,
                                       origin=self._juju_origin,
                                       public_key=public_key)

        # Debug log for the customize script, customize is only run on master.
        customize_log_path = os.path.join(self.juju_home, "units",
                                          "master-customize.log")
        master_template.customize_log = customize_log_path

        if not master_template.is_constructed():
            log.debug("Creating master container...")
            yield master_template.create()
            log.debug("Created master container %s" % container_template_name)

        # it wasn't constructed and we couldn't construct it
        if not master_template.is_constructed():
            raise LXCError("Unable to create master container")

        returnValue(master_template)