diff --git a/src/restic_compose_backup/cli.py b/src/restic_compose_backup/cli.py index d2a4ad8..bd8a763 100644 --- a/src/restic_compose_backup/cli.py +++ b/src/restic_compose_backup/cli.py @@ -46,15 +46,6 @@ def main(): elif args.action == 'alert': alert(config, containers) - # Random test stuff here - elif args.action == "test": - nodes = utils.get_swarm_nodes() - print("Swarm nodes:") - for node in nodes: - addr = node.attrs['Status']['Addr'] - state = node.attrs['Status']['State'] - print(' - {} {} {}'.format(node.id, addr, state)) - def backup(config, containers): """Request a backup to start""" diff --git a/src/restic_compose_backup/commands/test.py b/src/restic_compose_backup/commands/test.py index 5c619b4..45bffb3 100644 --- a/src/restic_compose_backup/commands/test.py +++ b/src/restic_compose_backup/commands/test.py @@ -1,9 +1,15 @@ from .base import BaseCommand - +from restic_compose_backup import utils class Command(BaseCommand): """Test a command""" name = "test" def run(self): - print("Test!") + """Random test command""" + nodes = utils.get_swarm_nodes() + print("Swarm nodes:") + for node in nodes: + addr = node.attrs['Status']['Addr'] + state = node.attrs['Status']['State'] + print(' - {} {} {}'.format(node.id, addr, state))