tessl install tessl/pypi-python-libmaas@0.6.0Python client library for MAAS 2.0+ with sync/async support, providing machine provisioning, network management, and storage configuration.
Access and configure MAAS system settings, retrieve version information, and manage global configuration parameters that affect all MAAS operations.
The MAAS class provides get/set methods for managing global system configuration. All settings can be accessed through the client.maas object.
# Instance name
client.maas.get_name() -> str
client.maas.set_name(name: str)
# Package archives
client.maas.get_main_archive() -> str
client.maas.set_main_archive(url: str)
client.maas.get_ports_archive() -> str
client.maas.set_ports_archive(url: str)
# Default operating system
client.maas.get_default_os() -> str
client.maas.set_default_os(os: str)
client.maas.get_default_distro_series() -> str
client.maas.set_default_distro_series(series: str)
client.maas.get_commissioning_distro_series() -> str
client.maas.set_commissioning_distro_series(series: str)
# Proxy configuration
client.maas.get_http_proxy() -> Optional[str]
client.maas.set_http_proxy(url: Optional[str])
client.maas.get_enable_http_proxy() -> bool
client.maas.set_enable_http_proxy(enabled: bool)
# Installation settings
client.maas.get_curtin_verbose() -> bool
client.maas.set_curtin_verbose(verbose: bool)
client.maas.get_kernel_options() -> Optional[str]
client.maas.set_kernel_options(options: Optional[str])
# DNS configuration
client.maas.get_upstream_dns() -> list
client.maas.set_upstream_dns(addresses: Optional[Sequence[str]])
client.maas.get_dnssec_validation() -> DNSSEC
client.maas.set_dnssec_validation(validation: DNSSEC)
client.maas.get_default_dns_ttl() -> int
client.maas.set_default_dns_ttl(ttl: int)
# Storage and deployment
client.maas.get_enable_disk_erasing_on_release() -> bool
client.maas.set_enable_disk_erasing_on_release(erase: bool)
client.maas.get_default_storage_layout() -> StorageLayout
client.maas.set_default_storage_layout(layout: StorageLayout)
client.maas.get_default_min_hwe_kernel() -> Optional[str]
client.maas.set_default_min_hwe_kernel(version: Optional[str])
# Windows and drivers
client.maas.get_windows_kms_host() -> Optional[str]
client.maas.set_windows_kms_host(host: Optional[str])
client.maas.get_enable_third_party_drivers() -> bool
client.maas.set_enable_third_party_drivers(enabled: bool)
# Boot images and time synchronization
client.maas.get_boot_images_auto_import() -> bool
client.maas.set_boot_images_auto_import(auto: bool)
client.maas.get_ntp_server() -> str
client.maas.set_ntp_server(server: str)
# Generic configuration access
client.maas.get_config(name: str)
client.maas.set_config(name: str, value)Configuration Settings:
maas_name: MAAS instance name for identificationmain_archive: Main package archive URL (Intel architectures), e.g., http://archive.ubuntu.com/ubuntuports_archive: Package archive for non-Intel architectures, e.g., http://ports.ubuntu.com/ubuntu-portsdefault_osystem: Default operating system used for deploymentdefault_distro_series: Default OS release for deployment (e.g., "focal", "jammy")commissioning_distro_series: Default Ubuntu release for commissioninghttp_proxy: HTTP/HTTPS proxy for APT and downloads. Used by nodes and MAAS for packages and boot imagesenable_http_proxy: Enable built-in or user-specified HTTP proxycurtin_verbose: Enable high verbosity in curtin installer logskernel_opts: Default kernel boot parametersupstream_dns: Space or comma-separated upstream DNS server addresses for non-MAAS domainsdnssec_validation: DNSSEC validation mode (see DNSSEC enum)default_dns_ttl: Default TTL for DNS responses in secondsenable_disk_erasing_on_release: Erase node disks when releasing machineswindows_kms_host: FQDN or IP of Windows KMS activation hostboot_images_auto_import: Automatically import/refresh boot images every 60 minutesntp_server: NTP server address provided to nodes via DHCP, e.g., ntp.ubuntu.comdefault_storage_layout: Default storage layout applied on deployment (see StorageLayout enum)default_min_hwe_kernel: Minimum HWE kernel version for new and commissioned nodesenable_third_party_drivers: Enable proprietary driver installation (e.g., HPVSA)from maas.client import connect
client = connect('http://maas.example.com:5240/MAAS/', apikey='key')
# Get current MAAS name
name = client.maas.get_name()
print(f"MAAS instance: {name}")
# Set HTTP proxy
client.maas.set_http_proxy('http://proxy.example.com:3128')
client.maas.set_enable_http_proxy(True)
# Configure default deployment
client.maas.set_default_distro_series('jammy')
client.maas.set_default_storage_layout(client.maas.StorageLayout.LVM)
# Configure DNS
client.maas.set_upstream_dns(['8.8.8.8', '8.8.4.4'])
client.maas.set_dnssec_validation(client.maas.DNSSEC.AUTO)
# Enable verbose installation logging
client.maas.set_curtin_verbose(True)Retrieve MAAS server version details and capabilities.
client.version.get()Version Object Properties:
version (str): MAAS version string (e.g., "3.2.0")version_info (tuple): Parsed version tuple (e.g., (3, 2, 0))subversion (str): Detailed version informationcapabilities (frozenset): Set of API capability stringsfrom maas.client import connect
client = connect('http://maas.example.com:5240/MAAS/', apikey='key')
# Get version information
version = client.version.get()
print(f"MAAS Version: {version.version}")
print(f"Version Info: {version.version_info}")
print(f"Subversion: {version.subversion}")
print(f"Capabilities: {version.capabilities}")
# Check for specific capability
if 'networks-management' in version.capabilities:
print("Network management available")from maas.client.viscera.maas import MAAS
class MAAS:
"""MAAS system configuration."""
class DNSSEC:
"""DNSSEC validation settings."""
AUTO = "auto" # Automatic (use default root key)
YES = "yes" # Yes (manually configured root key)
NO = "no" # No (disable DNSSEC)
class StorageLayout:
"""Default storage layout options."""
FLAT = "flat" # Flat layout
LVM = "lvm" # LVM layout
BCACHE = "bcache" # Bcache layout
@classmethod
def get_name(cls) -> str: ...
@classmethod
def set_name(cls, name: str): ...
@classmethod
def get_main_archive(cls) -> str: ...
@classmethod
def set_main_archive(cls, url: str): ...
@classmethod
def get_ports_archive(cls) -> str: ...
@classmethod
def set_ports_archive(cls, url: str): ...
@classmethod
def get_default_os(cls) -> str: ...
@classmethod
def set_default_os(cls, os: str): ...
@classmethod
def get_default_distro_series(cls) -> str: ...
@classmethod
def set_default_distro_series(cls, series: str): ...
@classmethod
def get_commissioning_distro_series(cls) -> str: ...
@classmethod
def set_commissioning_distro_series(cls, series: str): ...
@classmethod
def get_http_proxy(cls) -> Optional[str]: ...
@classmethod
def set_http_proxy(cls, url: Optional[str]): ...
@classmethod
def get_enable_http_proxy(cls) -> bool: ...
@classmethod
def set_enable_http_proxy(cls, enabled: bool): ...
@classmethod
def get_curtin_verbose(cls) -> bool: ...
@classmethod
def set_curtin_verbose(cls, verbose: bool): ...
@classmethod
def get_kernel_options(cls) -> Optional[str]: ...
@classmethod
def set_kernel_options(cls, options: Optional[str]): ...
@classmethod
def get_upstream_dns(cls) -> list: ...
@classmethod
def set_upstream_dns(cls, addresses: Optional[Sequence[str]]): ...
@classmethod
def get_dnssec_validation(cls) -> DNSSEC: ...
@classmethod
def set_dnssec_validation(cls, validation: DNSSEC): ...
@classmethod
def get_default_dns_ttl(cls) -> int: ...
@classmethod
def set_default_dns_ttl(cls, ttl: int): ...
@classmethod
def get_enable_disk_erasing_on_release(cls) -> bool: ...
@classmethod
def set_enable_disk_erasing_on_release(cls, erase: bool): ...
@classmethod
def get_windows_kms_host(cls) -> Optional[str]: ...
@classmethod
def set_windows_kms_host(cls, host: Optional[str]): ...
@classmethod
def get_boot_images_auto_import(cls) -> bool: ...
@classmethod
def set_boot_images_auto_import(cls, auto: bool): ...
@classmethod
def get_ntp_server(cls) -> str: ...
@classmethod
def set_ntp_server(cls, server: str): ...
@classmethod
def get_default_storage_layout(cls) -> StorageLayout: ...
@classmethod
def set_default_storage_layout(cls, layout: StorageLayout): ...
@classmethod
def get_default_min_hwe_kernel(cls) -> Optional[str]: ...
@classmethod
def set_default_min_hwe_kernel(cls, version: Optional[str]): ...
@classmethod
def get_enable_third_party_drivers(cls) -> bool: ...
@classmethod
def set_enable_third_party_drivers(cls, enabled: bool): ...
@classmethod
def get_config(cls, name: str): ...
@classmethod
def set_config(cls, name: str, value): ...
from maas.client.viscera.version import Version
class Version:
"""MAAS version information."""
version: str
version_info: tuple
subversion: str
capabilities: frozenset