Ejemplo n.º 1
0
    def body(self, lines):
        pers = self.dbobj.personality
        arch = pers.archetype

        # FIXME: Enforce that one of the interfaces is marked boot?
        for dbinterface in self.dbobj.hardware_entity.interfaces:
            # Management interfaces are not configured at the host level
            if dbinterface.interface_type == 'management':
                continue

        services = []
        required_services = set(arch.services + pers.services)

        for si in self.dbobj.services_used:
            required_services.discard(si.service)
            services.append(PlenaryServiceInstanceClientDefault.template_name(si))
        if required_services:
            missing = ", ".join(sorted([srv.name for srv in required_services]))
            raise IncompleteError("{0} is missing the following required "
                                  "services, please run 'aq reconfigure': "
                                  "{1!s}.".format(self.dbobj, missing))

        provides = []
        for srv in self.dbobj.services_provided:
            si = srv.service_instance
            provides.append(PlenaryServiceInstanceServerDefault.template_name(si))

        # Ensure used/provided services have a stable order
        services.sort()
        provides.sort()

        # Okay, here's the real content
        pan_include(lines, ["pan/units", "pan/functions"])
        lines.append("")

        path = PlenaryHostData.template_name(self.dbobj)
        pan_assign(lines, "/",
                   StructureTemplate(path,
                                     {"metadata": PanValue("/metadata")}))
        pan_include(lines, "archetype/base")

        opsys = self.dbobj.operating_system
        pan_include(lines, "os/%s/%s/config" % (opsys.name, opsys.version))

        pan_include(lines, services)
        pan_include(lines, provides)

        path = PlenaryPersonalityBase.template_name(pers)
        pan_include(lines, path)

        if self.dbobj.cluster:
            pan_include(lines,
                        PlenaryClusterClient.template_name(self.dbobj.cluster))
        elif pers.cluster_required:
            raise IncompleteError("{0} requires cluster membership, please "
                                  "run 'aq cluster'.".format(pers))
        pan_include(lines, "archetype/final")
Ejemplo n.º 2
0
    def body(self, lines):
        pan_include(lines, ["pan/units", "pan/functions"])
        pan_assign(lines, "/",
                   StructureTemplate("clusterdata/%s" % self.dbobj.name,
                                     {"metadata": PanValue("/metadata")}))
        pan_include(lines, "archetype/base")

        #for esx_management_server
        for servinst in sorted(self.dbobj.service_bindings):
            path = PlenaryServiceInstanceClientDefault.template_name(servinst)
            pan_include(lines, path)

        path = PlenaryPersonalityBase.template_name(self.dbobj.personality)
        pan_include(lines, path)
        pan_include(lines, "archetype/final")
Ejemplo n.º 3
0
    def body(self, lines):
        pan_include(lines, ["pan/units", "pan/functions"])
        path = PlenaryClusterData.template_name(self.dbobj)
        pan_assign(lines, "/",
                   StructureTemplate(path,
                                     {"metadata": PanValue("/metadata")}))
        pan_include(lines, "archetype/base")

        for servinst in sorted(self.dbobj.service_bindings,
                               key=attrgetter('service.name', 'name')):
            path = PlenaryServiceInstanceClientDefault.template_name(servinst)
            pan_include(lines, path)

        for srv in sorted(self.dbobj.services_provided,
                          key=attrgetter("service_instance.service.name",
                                         "service_instance.name")):
            path = PlenaryServiceInstanceServerDefault.template_name(srv.service_instance)
            pan_include(lines, path)

        path = PlenaryPersonalityBase.template_name(self.dbobj.personality)
        pan_include(lines, path)
        pan_include(lines, "archetype/final")