or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/python-libmaas@0.6.x

docs

index.md
tile.json

tessl/pypi-python-libmaas

tessl install tessl/pypi-python-libmaas@0.6.0

Python client library for MAAS 2.0+ with sync/async support, providing machine provisioning, network management, and storage configuration.

enums.mddocs/reference/

Enumerations

Type-safe enumerations for node states, power states, interface types, storage configurations, and other MAAS concepts.

Capabilities

Node Status

Machine and device lifecycle states.

from maas.client.enum import NodeStatus

class NodeStatus:
    """Node status enumeration."""
    DEFAULT = ...                          # Default (alias for NEW)
    NEW = ...                              # Newly enlisted
    COMMISSIONING = ...                    # Commissioning in progress
    FAILED_COMMISSIONING = ...             # Commissioning failed
    MISSING = ...                          # Node cannot be contacted
    READY = ...                            # Ready for allocation
    RESERVED = ...                         # Reserved for named deployment
    ALLOCATED = ...                        # Allocated to user
    DEPLOYING = ...                        # Deployment in progress
    DEPLOYED = ...                         # Successfully deployed
    RETIRED = ...                          # Retired from service
    BROKEN = ...                           # Marked as broken
    FAILED_DEPLOYMENT = ...                # Deployment failed
    RELEASING = ...                        # Release in progress
    FAILED_RELEASING = ...                 # Release failed
    DISK_ERASING = ...                     # Disk erase in progress
    FAILED_DISK_ERASING = ...              # Disk erase failed
    RESCUE_MODE = ...                      # In rescue mode
    ENTERING_RESCUE_MODE = ...             # Entering rescue mode
    FAILED_ENTERING_RESCUE_MODE = ...      # Failed to enter rescue mode
    EXITING_RESCUE_MODE = ...              # Exiting rescue mode
    FAILED_EXITING_RESCUE_MODE = ...       # Failed to exit rescue mode
    TESTING = ...                          # Testing in progress
    FAILED_TESTING = ...                   # Testing failed

Usage:

from maas.client import connect
from maas.client.enum import NodeStatus

client = connect('http://maas.example.com:5240/MAAS/', apikey='key')

# Check machine status
machine = client.machines.get('system_id')
if machine.status == NodeStatus.READY:
    print("Machine is ready for allocation")
elif machine.status == NodeStatus.DEPLOYED:
    print("Machine is deployed")

Node Type

Type of node in MAAS.

from maas.client.enum import NodeType

class NodeType:
    """Node type enumeration."""
    MACHINE = ...                          # Deployable machine
    DEVICE = ...                           # Non-deployable device
    RACK_CONTROLLER = ...                  # Rack controller
    REGION_CONTROLLER = ...                # Region controller
    REGION_AND_RACK_CONTROLLER = ...       # Combined controller

Power State

Machine power states.

from maas.client.enum import PowerState

class PowerState:
    """Power state enumeration."""
    ON = ...       # Powered on
    OFF = ...      # Powered off
    UNKNOWN = ...  # Power state unknown
    ERROR = ...    # Power query error

Usage:

from maas.client.enum import PowerState

# Query power state
state = machine.query_power_state()
if state == PowerState.ON:
    print("Machine is powered on")
elif state == PowerState.OFF:
    print("Machine is powered off")

Power Stop Mode

How to power off machines.

from maas.client.enum import PowerStopMode

class PowerStopMode:
    """Power stop mode enumeration."""
    SOFT = ...  # Graceful shutdown (ACPI)
    HARD = ...  # Immediate power off

Usage:

from maas.client.enum import PowerStopMode

# Graceful shutdown
machine.power_off(stop_mode=PowerStopMode.SOFT)

# Immediate power off
machine.power_off(stop_mode=PowerStopMode.HARD)

Reverse DNS Mode

Reverse DNS configuration for subnets.

from maas.client.enum import RDNSMode

class RDNSMode:
    """Reverse DNS mode enumeration."""
    DISABLED = ...  # Disabled
    ENABLED = ...   # Enabled (standard)
    RFC2317 = ...   # RFC2317 classless delegation

IP Range Type

Type of IP address range.

from maas.client.enum import IPRangeType

class IPRangeType:
    """IP range type enumeration."""
    DYNAMIC = ...   # Dynamic DHCP range
    RESERVED = ...  # Reserved range (not for DHCP)

Usage:

from maas.client.enum import IPRangeType

# Create dynamic range
ip_range = client.ip_ranges.create(
    type=IPRangeType.DYNAMIC,
    start_ip='192.168.1.100',
    end_ip='192.168.1.200',
    subnet=1
)

Interface Type

Network interface types.

from maas.client.enum import InterfaceType

class InterfaceType:
    """Network interface type enumeration."""
    PHYSICAL = ...  # Physical network interface
    BOND = ...      # Bonded interface
    BRIDGE = ...    # Bridge interface
    VLAN = ...      # VLAN interface
    UNKNOWN = ...   # Unknown type

Usage:

from maas.client.enum import InterfaceType

# Check interface type
for iface in machine.interface_set:
    if iface.type == InterfaceType.PHYSICAL:
        print(f"Physical interface: {iface.name}")
    elif iface.type == InterfaceType.BOND:
        print(f"Bond interface: {iface.name}")

Link Mode

Interface link configuration mode.

from maas.client.enum import LinkMode

class LinkMode:
    """Interface link mode enumeration."""
    AUTO = ...      # Automatic configuration
    DHCP = ...      # DHCP configuration
    STATIC = ...    # Static IP configuration
    LINK_UP = ...   # Link up only (no IP)

Block Device Type

Storage device types.

from maas.client.enum import BlockDeviceType

class BlockDeviceType:
    """Block device type enumeration."""
    PHYSICAL = ...  # Physical disk
    VIRTUAL = ...   # Virtual disk

Partition Table Type

Partition table formats.

from maas.client.enum import PartitionTableType

class PartitionTableType:
    """Partition table type enumeration."""
    MBR = ...  # Master Boot Record
    GPT = ...  # GUID Partition Table

RAID Level

RAID configuration levels.

from maas.client.enum import RaidLevel

class RaidLevel:
    """RAID level enumeration."""
    RAID_0 = ...   # RAID 0 (striping)
    RAID_1 = ...   # RAID 1 (mirroring)
    RAID_5 = ...   # RAID 5 (striping with parity)
    RAID_6 = ...   # RAID 6 (striping with double parity)
    RAID_10 = ...  # RAID 10 (mirrored stripes)

Cache Mode

Bcache caching modes.

from maas.client.enum import CacheMode

class CacheMode:
    """Cache mode enumeration for bcache."""
    WRITEBACK = ...     # Write to cache first
    WRITETHROUGH = ...  # Write to cache and backing device
    WRITEAROUND = ...   # Write to backing device only

Event Level

Event severity levels for system events and logging.

from maas.client.viscera.events import Level

class Level:
    """Event level enumeration (IntEnum)."""
    AUDIT = 0               # Audit events (user actions)
    DEBUG = 10              # Debug information
    INFO = 20               # Informational messages
    WARNING = 30            # Warning messages
    ERROR = 40              # Error messages
    CRITICAL = 50           # Critical errors

Usage:

from maas.client.viscera.events import Level

# Filter events by level
events = client.events.query(level=Level.ERROR)
critical_events = client.events.query(level=Level.CRITICAL)

# Can also use as string or int
events = client.events.query(level='WARNING')
events = client.events.query(level=30)

# Access via client.events.Level
events = client.events.query(level=client.events.Level.INFO)

Note: The Level enum corresponds to Python's logging module levels, making it intuitive for developers familiar with standard Python logging.

DNSSEC Validation Mode

DNSSEC validation configuration for DNS resolution.

from maas.client.viscera.maas import MAAS

class MAAS:
    class DNSSEC:
        """DNSSEC validation mode enumeration."""
        AUTO = ...  # Automatic based on upstream DNS
        YES = ...   # Enable DNSSEC validation
        NO = ...    # Disable DNSSEC validation

Usage:

from maas.client import connect
from maas.client.viscera.maas import MAAS

client = connect('http://maas.example.com:5240/MAAS/', apikey='key')

# Set DNSSEC validation
client.maas.set_dnssec_validation(MAAS.DNSSEC.YES)

# Get current setting
validation = client.maas.get_dnssec_validation()
if validation == MAAS.DNSSEC.AUTO:
    print("DNSSEC validation is automatic")

Storage Layout

Default storage layout for machine deployment.

from maas.client.viscera.maas import MAAS

class MAAS:
    class StorageLayout:
        """Default storage layout enumeration."""
        FLAT = ...    # Simple flat partitioning (default)
        LVM = ...     # LVM-based partitioning
        BCACHE = ...  # Bcache with SSD caching

Usage:

from maas.client import connect
from maas.client.viscera.maas import MAAS

client = connect('http://maas.example.com:5240/MAAS/', apikey='key')

# Set default storage layout for all deployments
client.maas.set_default_storage_layout(MAAS.StorageLayout.LVM)

# Get current default
layout = client.maas.get_default_storage_layout()
if layout == MAAS.StorageLayout.FLAT:
    print("Using flat storage layout")
elif layout == MAAS.StorageLayout.LVM:
    print("Using LVM storage layout")
elif layout == MAAS.StorageLayout.BCACHE:
    print("Using Bcache storage layout")

Importing Enumerations

# Import specific enums
from maas.client.enum import NodeStatus, PowerState, InterfaceType
from maas.client.viscera.events import Level
from maas.client.viscera.maas import MAAS

# Import all enums from maas.client.enum
from maas.client import enum

# Access MAAS nested enums
print(MAAS.DNSSEC.AUTO)
print(MAAS.StorageLayout.LVM)