예제 #1
0
class RefreshRackControllerInfo(amp.Command):
    """Refresh the rack controller's hardware and network details.

    :since: 2.0
    """
    arguments = [
        (b"system_id", amp.Unicode()),
        (b"consumer_key", amp.Unicode()),
        (b"token_key", amp.Unicode()),
        (b"token_secret", amp.Unicode()),
    ]
    response = [
        (b"hostname", amp.Unicode()),
        (b"architecture", amp.Unicode()),
        (b"osystem", amp.Unicode()),
        (b"distro_series", amp.Unicode()),
        (b"interfaces", StructureAsJSON()),
        (b"maas_version", amp.Unicode(optional=True)),
    ]
    errors = {
        exceptions.RefreshAlreadyInProgress: (b"RefreshAlreadyInProgress"),
    }
예제 #2
0
class _Power(amp.Command):
    """Base class for power control commands.

    :since: 1.7
    """

    arguments = [
        (b"system_id", amp.Unicode()),
        (b"hostname", amp.Unicode()),
        (b"power_type", amp.Unicode()),
        # We can't define a tighter schema here because this is a highly
        # variable bag of arguments from a variety of sources.
        (b"context", StructureAsJSON()),
    ]
    response = []
    errors = {
        exceptions.UnknownPowerType: (b"UnknownPowerType"),
        NotImplementedError: (b"NotImplementedError"),
        exceptions.PowerActionFail: (b"PowerActionFail"),
        exceptions.PowerActionAlreadyInProgress:
        (b"PowerActionAlreadyInProgress"),
    }
예제 #3
0
class SendPodCommissioningResults(amp.Command):
    """Send commissioning results from the Pod.

    :since: 2.8
    """

    arguments = [
        (b"pod_id", amp.Integer()),
        (b"name", amp.Unicode()),
        (b"type", amp.Unicode()),
        (b"system_id", amp.Unicode()),
        (b"context", StructureAsJSON()),
        (b"consumer_key", amp.Unicode()),
        (b"token_key", amp.Unicode()),
        (b"token_secret", amp.Unicode()),
        (b"metadata_url", ParsedURL()),
    ]
    errors = {
        exceptions.UnknownPodType: b"UnknownPodType",
        NotImplementedError: b"NotImplementedError",
        exceptions.PodActionFail: b"PodActionFail",
    }
예제 #4
0
class GetPreseedData(amp.Command):
    """Get OS-specific preseed data.

    :since: 1.7
    """

    arguments = [
        (b"osystem", amp.Unicode()),
        (b"preseed_type", amp.Unicode()),
        (b"node_system_id", amp.Unicode()),
        (b"node_hostname", amp.Unicode()),
        (b"consumer_key", amp.Unicode()),
        (b"token_key", amp.Unicode()),
        (b"token_secret", amp.Unicode()),
        (b"metadata_url", ParsedURL()),
    ]
    response = [
        (b"data", StructureAsJSON()),
    ]
    errors = {
        exceptions.NoSuchOperatingSystem: (b"NoSuchOperatingSystem"),
        NotImplementedError: (b"NotImplementedError"),
    }
예제 #5
0
class DiscoverPod(amp.Command):
    """Discover all the pod information.

    :since: 2.2
    """

    arguments = [
        (b"pod_id", amp.Integer(optional=True)),
        (b"name", amp.Unicode(optional=True)),
        (b"type", amp.Unicode()),
        # We can't define a tighter schema here because this is a highly
        # variable bag of arguments from a variety of sources.
        (b"context", StructureAsJSON()),
    ]
    response = [(
        b"pod",
        AttrsClassArgument("provisioningserver.drivers.pod.DiscoveredPod"),
    )]
    errors = {
        exceptions.UnknownPodType: b"UnknownPodType",
        NotImplementedError: b"NotImplementedError",
        exceptions.PodActionFail: b"PodActionFail",
    }
예제 #6
0
class DiscoverPodProjects(amp.Command):
    """Discover pod projects names.

    :since: 2.10
    """

    arguments = [
        (b"type", amp.Unicode()),
        # We can't define a tighter schema here because this is a highly
        # variable bag of arguments from a variety of sources.
        (b"context", StructureAsJSON()),
    ]
    response = [(
        b"projects",
        amp.ListOf(
            AttrsClassArgument(
                "provisioningserver.drivers.pod.DiscoveredPodProject")),
    )]
    errors = {
        exceptions.UnknownPodType: b"UnknownPodType",
        NotImplementedError: b"NotImplementedError",
        exceptions.PodActionFail: b"PodActionFail",
    }
예제 #7
0
class ComposeMachine(amp.Command):
    """Compose a machine in a pod.

    :since: 2.2
    """

    arguments = [
        (b"pod_id", amp.Integer()),
        (b"name", amp.Unicode()),
        (b"type", amp.Unicode()),
        # We can't define a tighter schema here because this is a highly
        # variable bag of arguments from a variety of sources.
        (b"context", StructureAsJSON()),
        (
            b"request",
            AttrsClassArgument(
                "provisioningserver.drivers.pod.RequestedMachine"),
        ),
    ]
    response = [
        (
            b"machine",
            AttrsClassArgument(
                "provisioningserver.drivers.pod.DiscoveredMachine"),
        ),
        (
            b"hints",
            AttrsClassArgument(
                "provisioningserver.drivers.pod.DiscoveredPodHints"),
        ),
    ]
    errors = {
        exceptions.UnknownPodType: b"UnknownPodType",
        NotImplementedError: b"NotImplementedError",
        exceptions.PodActionFail: b"PodActionFail",
        exceptions.PodInvalidResources: b"PodInvalidResources",
    }
예제 #8
0
class DecomposeMachine(amp.Command):
    """Decompose a machine in a pod.

    :since: 2.2
    """
    arguments = [
        (b"pod_id", amp.Integer()),
        (b"name", amp.Unicode()),
        (b"type", amp.Unicode()),
        # We can't define a tighter schema here because this is a highly
        # variable bag of arguments from a variety of sources.
        (b"context", StructureAsJSON()),
    ]
    response = [
        (b"hints", AmpDiscoveredPodHints()),
    ]
    errors = {
        exceptions.UnknownPodType: (
            b"UnknownPodType"),
        NotImplementedError: (
            b"NotImplementedError"),
        exceptions.PodActionFail: (
            b"PodActionFail"),
    }
예제 #9
0
파일: region.py 프로젝트: ocni-dtu/maas
class ListNodePowerParameters(amp.Command):
    """Return power parameters for the nodes in the specified cluster.

    This will only return power parameters for nodes that have power types for
    which MAAS has a query capability.

    It will return nodes in priority order. Those nodes at the beginning of
    the list should be queried first.

    It may return an empty list. This means that all nodes have been recently
    queried. Take a break before asking again.

    :since: 1.7
    """

    arguments = [
        # The cluster UUID.
        (b"uuid", amp.Unicode())
    ]
    response = [
        (
            b"nodes",
            AmpList(
                [
                    (b"system_id", amp.Unicode()),
                    (b"hostname", amp.Unicode()),
                    (b"power_state", amp.Unicode()),
                    (b"power_type", amp.Unicode()),
                    # We can't define a tighter schema here because this is a highly
                    # variable bag of arguments from a variety of sources.
                    (b"context", StructureAsJSON()),
                ]
            ),
        )
    ]
    errors = {NoSuchCluster: b"NoSuchCluster"}