From f1bebf4cb49510da4f70943a6aa406ec51d07857 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 26 Apr 2012 17:03:36 +0200 Subject: [PATCH] Make setup-ssh behave more friendly So while testing my previous patch I run setup-ssh manually without any arguments, and it did nothing (no complains, no messages, anything). That was very surprising, so let's make it behave better if no nodes are passed. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/client/gnt_node.py | 3 +++ tools/setup-ssh | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/client/gnt_node.py b/lib/client/gnt_node.py index 5f3f4207c..8dfba722c 100644 --- a/lib/client/gnt_node.py +++ b/lib/client/gnt_node.py @@ -138,6 +138,9 @@ def _RunSetupSSH(options, nodes): @param nodes: The nodes to setup """ + + assert nodes, "Empty node list" + cmd = [constants.SETUP_SSH] # Pass --debug|--verbose to the external script if set on our invocation diff --git a/tools/setup-ssh b/tools/setup-ssh index 50b7b7bb7..4e0907815 100755 --- a/tools/setup-ssh +++ b/tools/setup-ssh @@ -1,7 +1,7 @@ #!/usr/bin/python # -# Copyright (C) 2010 Google Inc. +# Copyright (C) 2010, 2012 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -253,6 +253,10 @@ def ParseOptions(): (options, args) = parser.parse_args() + if not args: + parser.print_help() + sys.exit(constants.EXIT_FAILURE) + return (options, args) -- GitLab