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.
Store and retrieve files in MAAS for use during machine deployment, such as configuration files, scripts, or cloud-init data. Files uploaded to MAAS can be referenced during commissioning, deployment, or other machine operations.
Retrieve metadata about all files stored in MAAS.
client.files.list()from maas.client import connect
client = connect('http://maas.example.com:5240/MAAS/', apikey='key')
# List all files
files = client.files.list()
for file in files:
print(f"Filename: {file.filename}")Each File object provides:
filename (str): Name of the file as stored in MAASFiles stored in MAAS can be accessed via the MAAS API using the file management endpoints. The python-libmaas library provides read-only access to file metadata through the Files.list() method.
For uploading files or performing write operations, use the MAAS REST API directly or the MAAS CLI tool:
# Using MAAS CLI to upload a file
maas <profile> files create filename=cloud-config.yaml content@=/path/to/file.yaml
# Using MAAS CLI to delete a file
maas <profile> file delete <filename>Files stored in MAAS can be referenced in curtin configs, cloud-init data, or commissioning scripts. They are typically accessed by machines during deployment via internal MAAS URLs.
from maas.client import connect
client = connect('http://maas.example.com:5240/MAAS/', apikey='key')
# Check available files
files = client.files.list()
print(f"Available files: {[f.filename for f in files]}")
# Deploy a machine that references stored files
machine = client.machines.allocate()
# Files can be referenced in user_data or curtin config during deploymentclass File:
"""A file stored in MAAS."""
filename: str