mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
container: Re-run failed provisioning even if container is running
- If provision fails and the container is in running state, then running './container up' does not lead to re-run of provisioning script. Fix this. Tests: - Without patch, insert 'exit 1' in provisioning script. Run './container destroy; ./container up'. Provision script will fail. Re-run './container up'. Provision script is not run and message that container is already running is printed. - With patch, insert 'exit 1' in provisioning script. Run './container destroy; ./container up'. Provision script will fail. Re-run './container up'. Provision script is not run and message that container is already running is printed. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
parent
939f122fb5
commit
3c3f9d1380
11
container
11
container
@ -916,6 +916,14 @@ def _destroy(distribution):
|
|||||||
_get_compressed_image_path(distribution))
|
_get_compressed_image_path(distribution))
|
||||||
|
|
||||||
|
|
||||||
|
def _is_privisioned(distribution):
|
||||||
|
"""Return the container has been provisioned fully."""
|
||||||
|
compressed_image = _get_compressed_image_path(distribution)
|
||||||
|
provision_file = compressed_image.with_suffix('.provisioned')
|
||||||
|
if provision_file.exists():
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def _provision(image_file, distribution):
|
def _provision(image_file, distribution):
|
||||||
"""Run app setup inside the container."""
|
"""Run app setup inside the container."""
|
||||||
provision_file = image_file.with_suffix(image_file.suffix + '.provisioned')
|
provision_file = image_file.with_suffix(image_file.suffix + '.provisioned')
|
||||||
@ -1038,7 +1046,8 @@ def _is_update_required(distribution):
|
|||||||
def subcommand_up(arguments):
|
def subcommand_up(arguments):
|
||||||
"""Download, setup and bring up the container."""
|
"""Download, setup and bring up the container."""
|
||||||
machine_name = f'fbx-{arguments.distribution}'
|
machine_name = f'fbx-{arguments.distribution}'
|
||||||
if _get_machine_status(machine_name):
|
if _get_machine_status(machine_name) and _is_privisioned(
|
||||||
|
arguments.distribution):
|
||||||
logger.info('Container is already running')
|
logger.info('Container is already running')
|
||||||
_print_banner(arguments.distribution)
|
_print_banner(arguments.distribution)
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user