wip
This commit is contained in:
parent
0232df0fa7
commit
0cc287fdd5
5 changed files with 37 additions and 35 deletions
|
@ -9,8 +9,8 @@ else
|
||||||
DRY='-n'
|
DRY='-n'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
% for dir, conf in dirs.items():
|
% for path, options in paths.items():
|
||||||
# ${dir}
|
# ${path}
|
||||||
gsutil ${'\\'}
|
gsutil ${'\\'}
|
||||||
-m ${'\\'}
|
-m ${'\\'}
|
||||||
-o 'GSUtil:parallel_process_count=${processes}' ${'\\'}
|
-o 'GSUtil:parallel_process_count=${processes}' ${'\\'}
|
||||||
|
@ -20,8 +20,8 @@ gsutil ${'\\'}
|
||||||
-r ${'\\'}
|
-r ${'\\'}
|
||||||
-d ${'\\'}
|
-d ${'\\'}
|
||||||
-e ${'\\'}
|
-e ${'\\'}
|
||||||
-x '${'|'.join(conf.get('exclude', []))}' ${'\\'}
|
-x '${'|'.join(options.get('exclude', []))}' ${'\\'}
|
||||||
'${dir}' ${'\\'}
|
'${options['encrypted_path']}' ${'\\'}
|
||||||
'gs://${bucket}/${node.name}${dir}' ${'\\'}
|
'gs://${bucket}/${node.name}${path}' ${'\\'}
|
||||||
2>&1 | tee | logger -t gsutil
|
2>&1 | logger -st gsutil
|
||||||
% endfor
|
% endfor
|
||||||
|
|
|
@ -6,7 +6,7 @@ files['/opt/archive'] = {
|
||||||
'content_type': 'mako',
|
'content_type': 'mako',
|
||||||
'mode': '700',
|
'mode': '700',
|
||||||
'context': {
|
'context': {
|
||||||
'dirs': node.metadata.get('archive'),
|
'paths': node.metadata.get('archive/paths'),
|
||||||
'bucket': node.metadata.get('gcloud/bucket'),
|
'bucket': node.metadata.get('gcloud/bucket'),
|
||||||
'processes': 4,
|
'processes': 4,
|
||||||
'threads': 4,
|
'threads': 4,
|
||||||
|
|
|
@ -1,22 +1,40 @@
|
||||||
defaults = {
|
defaults = {
|
||||||
'archive': {},
|
'archive': {
|
||||||
|
'paths': {},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@metadata_reactor.provides(
|
||||||
|
'archive/paths',
|
||||||
|
)
|
||||||
|
def paths(metadata):
|
||||||
|
return {
|
||||||
|
'archive': {
|
||||||
|
'paths': {
|
||||||
|
path: {
|
||||||
|
'encrypted_path': f'/mnt/gocryptfs{path}',
|
||||||
|
'exclude': [
|
||||||
|
'^\..*',
|
||||||
|
'/\..*',
|
||||||
|
],
|
||||||
|
} for path in metadata.get('archive/paths')
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@metadata_reactor.provides(
|
@metadata_reactor.provides(
|
||||||
'gocryptfs/paths',
|
'gocryptfs/paths',
|
||||||
)
|
)
|
||||||
def gocryptfs(metadata):
|
def gocryptfs(metadata):
|
||||||
paths = {}
|
|
||||||
|
|
||||||
for path in metadata.get('archive/paths'):
|
|
||||||
paths[path] = {
|
|
||||||
'mountpoint': f'/mnt/gocryptfs{path}',
|
|
||||||
'reverse': True,
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'gocryptfs': {
|
'gocryptfs': {
|
||||||
'paths': paths,
|
'paths': {
|
||||||
},
|
path: {
|
||||||
|
'mountpoint': options['encrypted_path'],
|
||||||
|
'reverse': True,
|
||||||
|
} for path, options in metadata.get('archive/paths').items()
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ def systemd(metadata):
|
||||||
'CIPHER': options["mountpoint"]
|
'CIPHER': options["mountpoint"]
|
||||||
},
|
},
|
||||||
'ExecStart': [
|
'ExecStart': [
|
||||||
'/usr/bin/gocryptfs -fg -reverse -masterkey $MASTERKEY -ctlsock $SOCKET $PLAIN $CIPHER',
|
'/usr/bin/gocryptfs -fg -plaintextnames -reverse -masterkey $MASTERKEY -ctlsock $SOCKET $PLAIN $CIPHER',
|
||||||
],
|
],
|
||||||
'ExecStopPost': [
|
'ExecStopPost': [
|
||||||
'/usr/bin/umount $CIPHER'
|
'/usr/bin/umount $CIPHER'
|
||||||
|
|
|
@ -13,19 +13,3 @@ defaults = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@metadata_reactor.provides(
|
|
||||||
'archive',
|
|
||||||
)
|
|
||||||
def exclude_hidden_files_from_archive(metadata):
|
|
||||||
return {
|
|
||||||
'archive': {
|
|
||||||
dir: {
|
|
||||||
'exclude': [
|
|
||||||
'^\..*',
|
|
||||||
'/\..*',
|
|
||||||
],
|
|
||||||
} for dir, conf in metadata.get('archive').items()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue