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.
---
 lib/client/gnt_node.py |    3 +++
 tools/setup-ssh        |    6 +++++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/lib/client/gnt_node.py b/lib/client/gnt_node.py
index 5f3f420..8dfba72 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 50b7b7b..4e09078 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)
 
 
-- 
1.7.7.3

Reply via email to