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
|
version = settings['version'] = int(settings.get('version', 0)) + 1
|
||||||
|
|
||||||
# Populate IP sets.
|
# Populate IP sets.
|
||||||
wireguard = db.read('wireguard')
|
wireguard = db.load('wireguard')
|
||||||
ipsets = collections.defaultdict(set)
|
ipsets = collections.defaultdict(set)
|
||||||
for ip, key in wireguard.items():
|
for ip, key in wireguard.items():
|
||||||
for group in user_groups.get(key.get('user', ''), ()):
|
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")
|
@click.option('--version', '-v', type=click.INT, default=None, help="Config version to push")
|
||||||
@flask.cli.with_appcontext
|
@flask.cli.with_appcontext
|
||||||
def push(version=None):
|
def push(version=None):
|
||||||
|
try:
|
||||||
|
with db.locked('nodes'):
|
||||||
if version is None:
|
if version is None:
|
||||||
version = db.load('settings').get('version', 0)
|
version = db.load('settings').get('version', 0)
|
||||||
|
|
||||||
|
@ -144,8 +146,6 @@ def push(version=None):
|
||||||
with open('config/version', 'w') as f:
|
with open('config/version', 'w') as f:
|
||||||
print(version, file=f)
|
print(version, file=f)
|
||||||
|
|
||||||
try:
|
|
||||||
with db.locked('nodes'):
|
|
||||||
nodes = db.read('nodes')
|
nodes = db.read('nodes')
|
||||||
tarfile = f'config/{version}.tar.gz'
|
tarfile = f'config/{version}.tar.gz'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue