feature: the VPN, the router, the name server and WebDAV are components switched on the System tab and installed on demand, Caddy from the Ubuntu archive is a dependency and serves every HTTP and HTTPS port, HTTPS is chosen at install, its certificate is of the Servers Issuing CA or self-signed by default, of ACME or of another CA, the issuing CAs are in one tab, a locked account is unlocked again, the name of a CA is fixed once the CA exists, and a run of setup is no longer cut short by a change.
Release / release (push) Failing after 8s
Release / release (push) Failing after 8s
This commit is contained in:
1 parent
a649331aa2
commit
a7bfabcb89
97 files changed
+4498
-1834
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"""What the modules of the web service share: the paths of the configuration and of the state linux-manager-setup writes,
|
||||
the limit of request bodies, the HTTP statuses of the failures of the server's modules, reading the configuration and
|
||||
the state, changing a section of the configuration, the state of a unit, and the log."""
|
||||
the state, changing settings of the configuration, the state of a unit, and the log."""
|
||||
|
||||
import json
|
||||
import sys
|
||||
@@ -59,15 +59,17 @@ def unit_state(unit):
|
||||
return result.stdout.strip() if result and result.stdout.strip() else 'unknown'
|
||||
|
||||
|
||||
def section_change(name, body):
|
||||
"""Change any of the settings of the configuration's section as /backup changes its own; the section, or the HTTP
|
||||
status and the error document as a tuple."""
|
||||
settings = {option: body[option] for option in linuxmanager.SCHEMA[name] if option in body}
|
||||
def settings_change(changes):
|
||||
"""Change settings of sections of the configuration in one step, section -> {setting: value}, keeping only the
|
||||
settings of SCHEMA, validated as a whole, and run setup; the configuration, or the HTTP status and the error document
|
||||
as a tuple."""
|
||||
try:
|
||||
with linuxmanager.config_lock():
|
||||
data = linuxmanager.read_settings()
|
||||
current = data.get(name)
|
||||
data[name] = {**(current if isinstance(current, dict) else {}), **settings}
|
||||
for name, body in changes.items():
|
||||
current = data.get(name)
|
||||
data[name] = {**(current if isinstance(current, dict) else {}),
|
||||
**{option: body[option] for option in linuxmanager.SCHEMA[name] if option in body}}
|
||||
cfg = linuxmanager.with_defaults(data)
|
||||
linuxmanager.validate(cfg)
|
||||
linuxmanager.save_config(data)
|
||||
@@ -77,8 +79,15 @@ def section_change(name, body):
|
||||
return 500, {'error': f'the configuration cannot be written: {exc}'}
|
||||
except SystemExit as exc:
|
||||
return 500, {'error': str(exc.code)}
|
||||
run('systemctl', 'restart', '--no-block', 'linux-manager-setup.service')
|
||||
return cfg[name]
|
||||
linuxmanager.request_setup()
|
||||
return cfg
|
||||
|
||||
|
||||
def section_change(name, body):
|
||||
"""Change any of the settings of the configuration's section as /backup changes its own; the section, or the HTTP
|
||||
status and the error document as a tuple."""
|
||||
changed = settings_change({name: body})
|
||||
return changed if isinstance(changed, tuple) else changed[name]
|
||||
|
||||
|
||||
def log(message):
|
||||
|
||||
Reference in new issue
Block a user