Fix locking
Or maybe break it further.
This commit is contained in:
parent
a791e2bcdd
commit
bba8193e14
|
@ -52,7 +52,7 @@ def save_config():
|
|||
version = settings['version'] = int(settings.get('version', 0)) + 1
|
||||
|
||||
# Populate IP sets.
|
||||
wireguard = db.read('wireguard')
|
||||
wireguard = db.load('wireguard')
|
||||
ipsets = collections.defaultdict(set)
|
||||
for ip, key in wireguard.items():
|
||||
for group in user_groups.get(key.get('user', ''), ()):
|
||||
|
@ -137,6 +137,8 @@ def generate():
|
|||
@click.option('--version', '-v', type=click.INT, default=None, help="Config version to push")
|
||||
@flask.cli.with_appcontext
|
||||
def push(version=None):
|
||||
try:
|
||||
with db.locked('nodes'):
|
||||
if version is None:
|
||||
version = db.load('settings').get('version', 0)
|
||||
|
||||
|
@ -144,8 +146,6 @@ def push(version=None):
|
|||
with open('config/version', 'w') as f:
|
||||
print(version, file=f)
|
||||
|
||||
try:
|
||||
with db.locked('nodes'):
|
||||
nodes = db.read('nodes')
|
||||
tarfile = f'config/{version}.tar.gz'
|
||||
|
||||
|
|
Loading…
Reference in a new issue