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
@@ -9,21 +9,22 @@ number, true or false, a list of strings separated by commas (an empty value is
|
||||
or a string. remove takes site_to_site.NAME and removes that connection. The configuration with
|
||||
the change is checked as linux-manager-setup checks it, and only then written with
|
||||
linuxmanager.save_config, holding linuxmanager.config_lock; linux-manager-setup applies it at its next
|
||||
run, which set and remove remind of. With --restart they restart linux-manager-setup and wait until
|
||||
it has applied the change. A failure is a message on standard error; the exit status is 2 for an
|
||||
invalid request and 1 for any other failure, a failed run of linux-manager-setup included. -h or
|
||||
--help shows the options.
|
||||
run, which set and remove remind of. With --restart they have linux-manager-setup run and wait until
|
||||
it has applied the change, as apply does without a change: a run in progress is not cut short but
|
||||
runs once more (linuxmanager.request_setup). A failure is a message on standard error; the exit
|
||||
status is 2 for an invalid request and 1 for any other failure, a failed run of linux-manager-setup
|
||||
included. -h or --help shows the options.
|
||||
|
||||
linux-manager-config-edit show
|
||||
linux-manager-config-edit set [--restart] SECTION.OPTION VALUE
|
||||
linux-manager-config-edit set [--restart] site_to_site.NAME.OPTION VALUE
|
||||
linux-manager-config-edit remove [--restart] site_to_site.NAME
|
||||
linux-manager-config-edit apply
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import copy
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, '/usr/lib/linux-manager')
|
||||
@@ -83,6 +84,7 @@ def main(argv):
|
||||
parser = Parser(prog='linux-manager-config-edit', description='Show and change the server configuration.')
|
||||
commands = parser.add_subparsers(dest='command', required=True, parser_class=Parser)
|
||||
commands.add_parser('show', help='print the configuration as indented JSON')
|
||||
commands.add_parser('apply', help='have linux-manager-setup apply the configuration and wait for it')
|
||||
setter = commands.add_parser('set', help='set a setting and write the configuration')
|
||||
setter.add_argument('key', metavar='SECTION.OPTION',
|
||||
help='the setting, such as web.port or site_to_site.NAME.option')
|
||||
@@ -91,12 +93,14 @@ def main(argv):
|
||||
remover.add_argument('key', metavar='site_to_site.NAME', help='the connection')
|
||||
for changer in (setter, remover):
|
||||
changer.add_argument('--restart', action='store_true',
|
||||
help='restart linux-manager-setup and wait until it has applied the change')
|
||||
help='have linux-manager-setup apply the change and wait for it')
|
||||
options = parser.parse_args(argv)
|
||||
|
||||
if options.command == 'show':
|
||||
print(json.dumps(read(), indent=2))
|
||||
return 0
|
||||
if options.command == 'apply':
|
||||
return applied()
|
||||
|
||||
with linuxmanager.config_lock():
|
||||
data = read()
|
||||
@@ -131,10 +135,15 @@ def main(argv):
|
||||
else:
|
||||
print(f'{options.key} removed from {linuxmanager.CONFIG_FILE}.')
|
||||
if not options.restart:
|
||||
print('Apply it with: systemctl restart linux-manager-setup, or --restart')
|
||||
print('Apply it with: linux-manager-config-edit apply, or --restart')
|
||||
return 0
|
||||
print('Restarting linux-manager-setup...', flush=True)
|
||||
if subprocess.run(['systemctl', 'restart', 'linux-manager-setup.service']).returncode != 0:
|
||||
return applied()
|
||||
|
||||
|
||||
def applied():
|
||||
"""Have linux-manager-setup apply the configuration and wait for it; the exit status."""
|
||||
print('Running linux-manager-setup...', flush=True)
|
||||
if not linuxmanager.request_setup(wait=True):
|
||||
print('linux-manager-config-edit: linux-manager-setup failed; see journalctl -u linux-manager-setup', file=sys.stderr)
|
||||
return 1
|
||||
print('linux-manager-setup applied it.')
|
||||
|
||||
Reference in new issue
Block a user