bundles/apt: rework gpg key handling
This commit is contained in:
parent
54371cf289
commit
ad620396f5
15 changed files with 214 additions and 178 deletions
|
@ -1,9 +1,9 @@
|
|||
actions = {
|
||||
'apt_update': {
|
||||
'command': 'apt-get update',
|
||||
'needed_by': [
|
||||
'needed_by': {
|
||||
'pkg_apt:',
|
||||
],
|
||||
},
|
||||
'triggered': True,
|
||||
'cascade_skip': False,
|
||||
},
|
||||
|
@ -67,37 +67,22 @@ for name, data in node.metadata.get('apt', {}).get('repos', {}).items():
|
|||
files['/etc/apt/sources.list.d/{}.list'.format(name)] = {
|
||||
'content_type': 'mako',
|
||||
'content': "\n".join(data['items']),
|
||||
'triggers': [
|
||||
'triggers': {
|
||||
'action:apt_update',
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
if 'key' in data:
|
||||
gpg_keys.add(data['key'])
|
||||
if data.get('install_gpg_key', True):
|
||||
files['/etc/apt/sources.list.d/{}.list'.format(name)]['needs'] = {
|
||||
'file:/etc/apt/trusted.gpg.d/{}.list.asc'.format(name),
|
||||
}
|
||||
|
||||
files['/etc/apt/sources.list.d/{}.list'.format(name)]['needs'] = [
|
||||
'action:add_gpg_key_{}'.format(data['key']),
|
||||
]
|
||||
|
||||
previous_action = None
|
||||
for key in gpg_keys:
|
||||
files['/etc/apt/gpg-keys/{}'.format(key)] = {
|
||||
'source': 'gpg-keys/{}'.format(key),
|
||||
}
|
||||
|
||||
action_name = 'add_gpg_key_{}'.format(key)
|
||||
action_item_name = 'action:' + action_name
|
||||
actions[action_name] = {
|
||||
'command': 'apt-key add /etc/apt/gpg-keys/{}'.format(key),
|
||||
'unless': 'apt-key export {} 2>/dev/null | grep -q "END PGP PUBLIC KEY BLOCK"'.format(key),
|
||||
'cascade_skip': False,
|
||||
'needed_by': ["action:apt_update"],
|
||||
'needs': list(filter(None, [
|
||||
'file:/etc/apt/gpg-keys/{}'.format(key),
|
||||
previous_action,
|
||||
])),
|
||||
}
|
||||
previous_action = action_item_name
|
||||
files['/etc/apt/trusted.gpg.d/{}.list.asc'.format(name)] = {
|
||||
'source': 'gpg-keys/{}.asc'.format(name),
|
||||
'triggers': {
|
||||
'action:apt_update',
|
||||
},
|
||||
}
|
||||
|
||||
if node.metadata.get('apt', {}).get('packages', {}):
|
||||
for package, options in node.metadata['apt']['packages'].items():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue