Beispiel #1
0
    def enqueue_deployed_charms(self):
        """Send all deployed charms to CharmQueue for relation setting and
        post-proc.
        """

        log.debug("Starting CharmQueue for relation setting and"
                  " post-processing enqueueing {}".format(
                      [c.charm_name for c in self.deployed_charm_classes]))

        charm_q = CharmQueue(ui=self.ui)
        for charm_class in self.deployed_charm_classes:
            charm = charm_class(juju=self.juju, juju_state=self.juju_state,
                                ui=self.ui)
            charm_q.add_relation(charm)
            charm_q.add_post_proc(charm)

        charm_q.watch_relations()
        charm_q.watch_post_proc()
        charm_q.is_running = True

        self.info_message(
            "Services deployed, relationships may still be"
            " pending. Please wait for all services to be checked before"
            " deploying compute nodes")
        self.render_nodes(self.nodes, self.juju_state, self.maas_state)
    def enqueue_deployed_charms(self):
        """Send all deployed charms to CharmQueue for relation setting and
        post-proc.
        """
        charm_q = CharmQueue(ui=self.ui, config=self.config,
                             juju=self.juju, juju_state=self.juju_state,
                             deployed_charms=self.deployed_charm_classes)

        if self.config.getopt('headless'):
            charm_q.watch_relations()
            charm_q.watch_post_proc()
        else:
            charm_q.watch_relations_async()
            charm_q.watch_post_proc_async()
        charm_q.is_running = True

        # Exit cleanly if we've finished all deploys, relations,
        # post processing, and running in headless mode.
        if self.config.getopt('headless'):
            while not self.config.getopt('deploy_complete'):
                self.ui.status_info_message(
                    "Waiting for services to be started.")
                # FIXME: Is this needed?
                # time.sleep(10)
            self.ui.status_info_message(
                "All services deployed, relations set, and started")
            self.loop.exit(0)

        self.ui.status_info_message(
            "Services deployed, relationships may still be"
            " pending. Please wait for all services to be checked before"
            " deploying compute nodes")
        self.ui.render_services_view(self.nodes, self.juju_state,
                                     self.maas_state, self.config)
        self.loop.redraw_screen()
Beispiel #3
0
    def enqueue_deployed_charms(self):
        """Send all deployed charms to CharmQueue for relation setting and
        post-proc.
        """
        charm_q = CharmQueue(ui=self.ui, config=self.config,
                             juju=self.juju, juju_state=self.juju_state,
                             deployed_charms=self.deployed_charm_classes)

        if self.config.getopt('headless'):
            charm_q.watch_relations()
            charm_q.watch_post_proc()
        else:
            charm_q.watch_relations_async()
            charm_q.watch_post_proc_async()
        charm_q.is_running = True

        # Exit cleanly if we've finished all deploys, relations,
        # post processing, and running in headless mode.
        if self.config.getopt('headless'):
            while not self.config.getopt('deploy_complete'):
                self.ui.status_info_message(
                    "Waiting for services to be started.")
                # FIXME: Is this needed?
                # time.sleep(10)
            self.ui.status_info_message(
                "All services deployed, relations set, and started")
            self.loop.exit(0)

        self.ui.status_info_message(
            "Services deployed, relationships may still be"
            " pending. Please wait for all services to be checked before"
            " deploying compute nodes")
        self.ui.render_services_view(self.nodes, self.juju_state,
                                     self.maas_state, self.config)
        self.loop.redraw_screen()
Beispiel #4
0
    def enqueue_deployed_charms(self):
        """Send all deployed charms to CharmQueue for relation setting and
        post-proc.
        """

        log.debug("Starting CharmQueue for relation setting and"
                  " post-processing enqueueing {}".format(
                      [c.charm_name for c in self.deployed_charm_classes]))

        charm_q = CharmQueue(ui=self.ui)
        for charm_class in self.deployed_charm_classes:
            charm = charm_class(juju=self.juju,
                                juju_state=self.juju_state,
                                ui=self.ui)
            charm_q.add_relation(charm)
            charm_q.add_post_proc(charm)

        charm_q.watch_relations()
        charm_q.watch_post_proc()
        charm_q.is_running = True

        self.info_message(
            "Services deployed, relationships may still be"
            " pending. Please wait for all services to be checked before"
            " deploying compute nodes.")
        self.render_nodes(self.nodes, self.juju_state, self.maas_state)
Beispiel #5
0
    def add_charm(self, count=0, charm=None):
        if not charm:
            self.ui.hide_add_charm_info()
            return
        svc = self.juju_state.service(charm)
        if svc.service:
            self.info_message("Adding {n} units of {charm}".format(
                n=count, charm=charm))
            self.juju.add_unit(charm, num_units=int(count))
        else:
            charm_q = CharmQueue(ui=self.ui)
            charm_sel = get_charm(charm,
                                  self.juju,
                                  self.juju_state,
                                  self.ui)
            log.debug("Add charm: {}".format(charm_sel))
            if not charm_sel.isolate:
                charm_sel.machine_id = 'lxc:{mid}'.format(mid="1")

            self.info_message("Adding {} to environment".format(
                charm_sel))
            charm_q.add_deploy(charm_sel)
            charm_q.add_relation(charm_sel)
            charm_q.add_post_proc(charm_sel)

            # Add charm dependencies
            if len(charm_sel.related) > 0:
                for c in charm_sel.related:
                    svc = self.juju_state.service(charm_sel)
                    if not svc.service:
                        self.info_message("Adding dependent "
                                          "charm {c}".format(c=c))
                        charm_dep = get_charm(c,
                                              self.juju,
                                              self.juju_state,
                                              self.ui)
                        if not charm_dep.isolate:
                            charm_dep.machine_id = 'lxc:{mid}'.format(mid="1")
                        charm_q.add_deploy(charm_dep)
                        charm_q.add_relation(charm_dep)
                        charm_q.add_post_proc(charm_dep)

            if not charm_q.is_running:
                charm_q.watch_deploy()
                charm_q.watch_relations()
                charm_q.watch_post_proc()
                charm_q.is_running = True
        self.ui.hide_add_charm_info()
        return
Beispiel #6
0
    def enqueue_deployed_charms(self):
        """Send all deployed charms to CharmQueue for relation setting and
        post-proc.
        """
        charm_q = CharmQueue(ui=self.ui, config=self.config,
                             juju=self.juju, juju_state=self.juju_state,
                             deployed_charms=self.deployed_charm_classes)

        if self.config.getopt('headless'):
            charm_q.watch_relations()
            charm_q.watch_post_proc()
        else:
            async.submit(charm_q.watch_relations,
                         self.ui.show_exception_message)
            async.submit(charm_q.watch_post_proc,
                         self.ui.show_exception_message)

        charm_q.is_running = True

        # Exit cleanly if we've finished all deploys, relations,
        # post processing, and running in headless mode.
        if self.config.getopt('headless'):
            while not self.config.getopt('postproc_complete'):
                self.ui.status_info_message(
                    "Waiting for services to be started.")
                # FIXME: Is this needed?
                # time.sleep(10)
            self.ui.status_info_message(
                "All services deployed, relations set, and started")
            self.loop.exit(0)

        session_id = self.config.getopt('session_id')
        if self.config.is_single():
            utils.pollinate(session_id, 'DS')
        elif self.config.is_multi():
            utils.pollinate(session_id, 'DM')

        if charm_q.charm_post_proc_q.empty():
            self.ui.status_info_message("Ready.")

        self.ui.render_services_view(self.nodes, self.juju_state,
                                     self.maas_state, self.config)
        self.loop.redraw_screen()
Beispiel #7
0
    def add_charm(self, count=0, charm=None):
        if not charm:
            self.ui.hide_add_charm_info()
            return
        svc = self.juju_state.service(charm)
        if svc.service:
            self.info_message("Adding {n} units of {charm}".format(
                n=count, charm=charm))
            self.juju.add_unit(charm, num_units=int(count))
        else:
            charm_q = CharmQueue(ui=self.ui)
            charm_sel = get_charm(charm, self.juju, self.juju_state, self.ui)
            log.debug("Add charm: {}".format(charm_sel))
            if not charm_sel.isolate:
                charm_sel.machine_id = 'lxc:{mid}'.format(mid="1")

            self.info_message("Adding {} to environment".format(charm_sel))
            charm_q.add_setup(charm_sel)
            charm_q.add_relation(charm_sel)
            charm_q.add_post_proc(charm_sel)

            # Add charm dependencies
            if len(charm_sel.related) > 0:
                for c in charm_sel.related:
                    svc = self.juju_state.service(charm_sel)
                    if not svc.service:
                        self.info_message("Adding dependent "
                                          "charm {c}".format(c=c))
                        charm_dep = get_charm(c, self.juju, self.juju_state,
                                              self.ui)
                        if not charm_dep.isolate:
                            charm_dep.machine_id = 'lxc:{mid}'.format(mid="1")
                        charm_q.add_setup(charm_dep)
                        charm_q.add_relation(charm_dep)
                        charm_q.add_post_proc(charm_dep)

            if not charm_q.is_running:
                charm_q.watch_setup()
                charm_q.watch_relations()
                charm_q.watch_post_proc()
                charm_q.is_running = True
        self.ui.hide_add_charm_info()
        return