bundles/backup-{client,server}: use node names, only deploy users to correct backup server
Some checks failed
kunsi/bundlewrap/pipeline/head There was a failure building this commit

This commit is contained in:
Franzi 2022-01-04 17:14:55 +01:00
parent 05aa78c254
commit 3e0269ba99
Signed by: kunsi
GPG key ID: 12E3D2136B818350
5 changed files with 20 additions and 11 deletions

View file

@ -1,4 +1,7 @@
defaults = {
'backup-server': {
'my_ssh_port': 22,
},
'openssh': {
'allowed_users': {
# Usernames for backup clients always start with 'c-'
@ -9,6 +12,7 @@ defaults = {
@metadata_reactor.provides(
'backup-server/clients',
'backup-server/my_hostname',
)
def get_my_clients(metadata):
my_clients = {}
@ -17,6 +21,9 @@ def get_my_clients(metadata):
if not rnode.has_bundle('backup-client') or rnode.metadata.get('backups/exclude_from_backups', False):
continue
if node.name != rnode.metadata.get('backup-client/target'):
continue
my_clients[rnode.name] = {
'user': rnode.metadata.get('backup-client/user-name'),
}
@ -24,6 +31,7 @@ def get_my_clients(metadata):
return {
'backup-server': {
'clients': my_clients,
'my_hostname': metadata.get('hostname'),
},
}