From d7492e51f693cdfa035047f75a92db59ebb1ef5d Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Sun, 8 Mar 2020 18:36:29 +0100 Subject: [PATCH] Test command for listing swarm nodes --- src/restic_compose_backup/cli.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/restic_compose_backup/cli.py b/src/restic_compose_backup/cli.py index 82e4892..9e969fc 100644 --- a/src/restic_compose_backup/cli.py +++ b/src/restic_compose_backup/cli.py @@ -51,6 +51,15 @@ def main(): elif args.action == "crontab": crontab(config) + # 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 status(config, containers): """Outputs the backup config for the compose setup""" @@ -283,6 +292,7 @@ def parse_args(): 'cleanup', 'version', 'crontab', + 'test', ], ) parser.add_argument(