bundles/apt: suport deb822-style sources

This commit is contained in:
Franzi 2023-09-24 15:22:14 +02:00
parent 787607b5a1
commit 74baeb4bf4
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 45 additions and 13 deletions

View file

@ -0,0 +1,9 @@
% for uri in sorted(uris):
Types: ${' '.join(sorted(data.get('types', {'deb'})))}
URIs: ${uri}
Suites: ${os_release}
Components: ${' '.join(sorted(data.get('components', {'main'})))}
Architectures: ${' '.join(sorted(data.get('architectures', {'amd64'})))}
Signed-By: /etc/apt/trusted.gpg.d/${name}.list.asc
% endfor

View file

@ -169,6 +169,7 @@ if node.os_version[0] >= 11:
} }
for name, data in node.metadata.get('apt/repos', {}).items(): for name, data in node.metadata.get('apt/repos', {}).items():
if 'items' in data:
files['/etc/apt/sources.list.d/{}.list'.format(name)] = { files['/etc/apt/sources.list.d/{}.list'.format(name)] = {
'content_type': 'mako', 'content_type': 'mako',
'content': ("\n".join(sorted(data['items']))).format( 'content': ("\n".join(sorted(data['items']))).format(
@ -179,8 +180,30 @@ for name, data in node.metadata.get('apt/repos', {}).items():
'action:apt_update', 'action:apt_update',
}, },
} }
elif 'uris' in data:
uris = {
x.format(
os=node.os,
os_release=supported_os[node.os][node.os_version[0]],
) for x in data['uris']
}
files['/etc/apt/sources.list.d/{}.sources'.format(name)] = {
'source': 'deb822-sources',
'content_type': 'mako',
'context': {
'data': data,
'name': name,
'os_release': supported_os[node.os][node.os_version[0]],
'uris': uris,
},
'triggers': {
'action:apt_update',
},
}
if data.get('install_gpg_key', True): if data.get('install_gpg_key', True):
if 'items' in data:
files['/etc/apt/sources.list.d/{}.list'.format(name)]['needs'] = { files['/etc/apt/sources.list.d/{}.list'.format(name)]['needs'] = {
'file:/etc/apt/trusted.gpg.d/{}.list.asc'.format(name), 'file:/etc/apt/trusted.gpg.d/{}.list.asc'.format(name),
} }