mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
bind: Bump version and handle upgrade
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
3f0642109c
commit
c78d96984b
13
actions/bind
13
actions/bind
@ -31,7 +31,10 @@ def parse_arguments():
|
||||
"""Return parsed command line arguments as dictionary"""
|
||||
parser = argparse.ArgumentParser()
|
||||
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
||||
subparsers.add_parser('setup', help='Setup for BIND')
|
||||
setup = subparsers.add_parser('setup', help='Setup for BIND')
|
||||
setup.add_argument(
|
||||
'--old-version', type=int, required=True,
|
||||
help='Earlier version of the app that is already setup.')
|
||||
|
||||
configure = subparsers.add_parser('configure', help='Configure BIND')
|
||||
configure.add_argument('--forwarders',
|
||||
@ -43,11 +46,11 @@ def parse_arguments():
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def subcommand_setup(_):
|
||||
def subcommand_setup(arguments):
|
||||
"""Setup BIND configuration."""
|
||||
conf_file = open(CONFIG_FILE, "w")
|
||||
conf_file.write(DEFAULT_CONFIG)
|
||||
conf_file.close()
|
||||
if arguments.old_version == 0:
|
||||
with open(CONFIG_FILE, "w") as conf_file:
|
||||
conf_file.write(DEFAULT_CONFIG)
|
||||
|
||||
Path(ZONES_DIR).mkdir(exist_ok=True, parents=True)
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ from plinth.utils import format_lazy
|
||||
|
||||
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||
|
||||
version = 1
|
||||
version = 2
|
||||
|
||||
name = _('BIND')
|
||||
|
||||
@ -127,7 +127,9 @@ def init():
|
||||
def setup(helper, old_version=None):
|
||||
"""Install and configure the module."""
|
||||
helper.install(managed_packages)
|
||||
helper.call('post', actions.superuser_run, 'bind', ['setup'])
|
||||
helper.call(
|
||||
'post', actions.superuser_run, 'bind',
|
||||
['setup', '--old-version', str(old_version)])
|
||||
helper.call('post', app.enable)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user