update: the history of the package is CHANGELOG.md, from which the build writes debian/changelog, the build, publish and development scripts are in Python, and the development tools keep their settings and credentials in .lm-dev-config.
Release / release (push) Failing after 14m43s

This commit is contained in:
slawek committed 2026-11-24 06:51:04 +01:00
1 parent a7bfabcb89
commit 6911d16fa3
26 files changed
+1966 -2105

No files matched your search

+30 -22
View File
@@ -21,17 +21,20 @@ project and those files.
import argparse
import json
import os
import re
import subprocess
import sys
import time
from lm_dev import PROJECT, TESTS, VAULT_PORT, VaultError, config_path, enrol_instance, lxc_exec, vault_initialise, \
vault_state, vault_unseal
from lm_dev import PROJECT, TESTS, VAULT_PORT, MissingSetting, VaultError, config_path, enrol_instance, lxc_exec, \
setting, vault_initialise, vault_state, vault_unseal
NETWORKS = ('wan', 'lana', 'lanb')
# The settings of the options of uplink setup, which have no defaults.
UPLINK_SETTINGS = {'parent': 'LXD_UPLINK_PARENT', 'gateway': 'LXD_UPLINK_GATEWAY', 'dns': 'LXD_UPLINK_DNS',
'ovn_ranges': 'LXD_UPLINK_OVN_RANGES', 'routes': 'LXD_UPLINK_ROUTES'}
def lxc(*args, project, check=True, input=None):
"""Run lxc with the arguments in the project; raise CalledProcessError when it fails, unless check is false."""
@@ -217,10 +220,11 @@ def uplink(args):
if exists:
print(f'{args.remote} has the network {args.uplink} already')
return
missing = [option for option, value in (('--parent', args.parent), ('--gateway', args.gateway), ('--dns', args.dns),
('--ovn-ranges', args.ovn_ranges), ('--routes', args.routes)) if not value]
if missing:
sys.exit(f'uplink setup needs {", ".join(missing)}')
for option, name in UPLINK_SETTINGS.items():
try:
setattr(args, option, getattr(args, option) or setting(name))
except MissingSetting as missing:
sys.exit(f'uplink setup: --{option.replace("_", "-")} or {missing}')
lxc('network', 'create', network, '--type=physical', f'parent={args.parent}', f'ipv4.gateway={args.gateway}',
f'dns.nameservers={args.dns}', f'ipv4.ovn.ranges={args.ovn_ranges}', f'ipv4.routes={args.routes}',
project='default')
@@ -233,31 +237,33 @@ def main():
parser.add_argument('action', choices=('create', 'remove', 'vault', 'uplink'))
parser.add_argument('operation', nargs='?', choices=('setup', 'create', 'unseal', 'remove'),
help='after vault: create, unseal or remove; after uplink: setup or remove')
parser.add_argument('--remote', default=os.environ.get('LXD_REMOTE'), help='the lxc remote (LXD_REMOTE)')
parser.add_argument('--pool', default=os.environ.get('LXD_POOL'),
parser.add_argument('--remote', help='the lxc remote (LXD_REMOTE)')
parser.add_argument('--pool',
help='the storage pool of the project, for create (LXD_POOL)')
parser.add_argument('--project', default=os.environ.get('LXD_PROJECT', PROJECT),
parser.add_argument('--project', default=setting('LXD_PROJECT', PROJECT),
help=f'the project (LXD_PROJECT, default {PROJECT})')
parser.add_argument('--image', default=os.environ.get('LXD_IMAGE', 'ubuntu:26.04'),
parser.add_argument('--image', default=setting('LXD_IMAGE', 'ubuntu:26.04'),
help='the image of the repository container (LXD_IMAGE, default ubuntu:26.04)')
parser.add_argument('--vault-address', default=os.environ.get('LXD_VAULT_ADDRESS'),
parser.add_argument('--vault-address', default=setting('LXD_VAULT_ADDRESS', None),
help="the listen address of the Vault's forward, one of the uplink's routes "
'(LXD_VAULT_ADDRESS); without it one is allocated')
parser.add_argument('--uplink', default=os.environ.get('LXD_UPLINK', 'uplink'),
parser.add_argument('--uplink', default=setting('LXD_UPLINK', 'uplink'),
help='the physical uplink network of the OVN networks (LXD_UPLINK, default uplink)')
parser.add_argument('--parent', default=os.environ.get('LXD_UPLINK_PARENT'),
parser.add_argument('--parent',
help='uplink setup: the host bridge on the LAN (LXD_UPLINK_PARENT)')
parser.add_argument('--gateway', default=os.environ.get('LXD_UPLINK_GATEWAY'),
parser.add_argument('--gateway',
help='uplink setup: the LAN gateway as address/prefix (LXD_UPLINK_GATEWAY)')
parser.add_argument('--dns', default=os.environ.get('LXD_UPLINK_DNS'),
parser.add_argument('--dns',
help='uplink setup: the LAN name servers, comma-separated (LXD_UPLINK_DNS)')
parser.add_argument('--ovn-ranges', default=os.environ.get('LXD_UPLINK_OVN_RANGES'),
parser.add_argument('--ovn-ranges',
help='uplink setup: LAN addresses for OVN routers, FIRST-LAST (LXD_UPLINK_OVN_RANGES)')
parser.add_argument('--routes', default=os.environ.get('LXD_UPLINK_ROUTES'),
parser.add_argument('--routes',
help='uplink setup: LAN subnets for network forwards, CIDR (LXD_UPLINK_ROUTES)')
args = parser.parse_args()
if not args.remote:
parser.error('--remote or LXD_REMOTE is required')
try:
args.remote = args.remote or setting('LXD_REMOTE')
except MissingSetting as missing:
parser.error(f'--remote or {missing}')
operations = {'uplink': ('setup', 'remove'), 'vault': ('create', 'unseal', 'remove')}
if args.operation not in operations.get(args.action, (None,)):
parser.error('setup or remove follows uplink, create, unseal or remove follows vault, and nothing else')
@@ -292,8 +298,10 @@ def main():
if args.action == 'remove':
sys.exit(0 if remove(args, state, key) else 1)
if not args.pool:
parser.error('--pool or LXD_POOL is required')
try:
args.pool = args.pool or setting('LXD_POOL')
except MissingSetting as missing:
parser.error(f'--pool or {missing}')
if subprocess.run(['lxc', 'project', 'show', f'{args.remote}:{args.project}'], capture_output=True).returncode == 0:
sys.exit(f'project {args.project} exists on {args.remote}; remove it first or choose another --project')
state.parent.mkdir(parents=True, exist_ok=True)