diff --git a/daemons/ganeti-confd b/daemons/ganeti-confd index de127009050246c218dfa44a3d6a41689e3ed1f3..27b11a47761af8a0e6abddbd2ae723abf2a177a5 100755 --- a/daemons/ganeti-confd +++ b/daemons/ganeti-confd @@ -329,6 +329,10 @@ def CheckConfd(options, args): """Initial checks whether to run exit with a failure. """ + if args: # confd doesn't take any arguments + print >> sys.stderr, ("Usage: %s [-f] [-d] [-b ADDRESS]" % sys.argv[0]) + sys.exit(constants.EXIT_FAILURE) + # TODO: collapse HMAC daemons handling in daemons GenericMain, when we'll # have more than one. if not os.path.isfile(constants.HMAC_CLUSTER_KEY): diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd index 295141022bd1e93d7819628dff2b017f8a1aae71..81becca22f70e2cd0117126661f5ec66c16516df 100755 --- a/daemons/ganeti-masterd +++ b/daemons/ganeti-masterd @@ -538,6 +538,10 @@ def CheckMasterd(options, args): """Initial checks whether to run or exit with a failure. """ + if args: # masterd doesn't take any arguments + print >> sys.stderr, ("Usage: %s [-f] [-d]" % sys.argv[0]) + sys.exit(constants.EXIT_FAILURE) + ssconf.CheckMaster(options.debug) # If CheckMaster didn't fail we believe we are the master, but we have to diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index 4e24224ca0e7f855e5d22cef3eb8ec2104a3bee1..9aa71870c3f581b87ae7694bdc34d4cd766016b8 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -787,6 +787,16 @@ class NodeHttpServer(http.server.HttpServer): # pylint: disable-msg=R0904 return backend.ValidateHVParams(hvname, hvparams) +def CheckNoded(_, args): + """Initial checks whether to run or exit with a failure. + + """ + if args: # noded doesn't take any arguments + print >> sys.stderr, ("Usage: %s [-f] [-d] [-p port] [-b ADDRESS]" % + sys.argv[0]) + sys.exit(constants.EXIT_FAILURE) + + def ExecNoded(options, args): """Main node daemon function, executed with the PID file held. @@ -824,7 +834,7 @@ def main(): dirs = [(val, constants.RUN_DIRS_MODE) for val in constants.SUB_RUN_DIRS] dirs.append((constants.LOG_OS_DIR, 0750)) dirs.append((constants.LOCK_DIR, 1777)) - daemon.GenericMain(constants.NODED, parser, dirs, None, ExecNoded) + daemon.GenericMain(constants.NODED, parser, dirs, CheckNoded, ExecNoded) if __name__ == '__main__': diff --git a/daemons/ganeti-rapi b/daemons/ganeti-rapi index 48816c10e0c572c8776751faecdb9e0c8e8bcb12..8fd5265b4135b62470c04dd110c3f88a06f1813e 100755 --- a/daemons/ganeti-rapi +++ b/daemons/ganeti-rapi @@ -187,9 +187,9 @@ def CheckRapi(options, args): """Initial checks whether to run or exit with a failure. """ - if len(args) != 0: - print >> sys.stderr, "Usage: %s [-f] [-d] [-p port] [-b ADDRESS]" % \ - sys.argv[0] + if args: # rapi doesn't take any arguments + print >> sys.stderr, ("Usage: %s [-f] [-d] [-p port] [-b ADDRESS]" % + sys.argv[0]) sys.exit(constants.EXIT_FAILURE) ssconf.CheckMaster(options.debug) diff --git a/daemons/ganeti-watcher b/daemons/ganeti-watcher index d82b8ba0046474834c4d8a3aec6c93783a57a25b..6c97d40b752a2dd9b6cc183e9c769b20ecf4f513 100755 --- a/daemons/ganeti-watcher +++ b/daemons/ganeti-watcher @@ -470,7 +470,11 @@ def main(): """ global client # pylint: disable-msg=W0603 - options, _ = ParseOptions() + options, args = ParseOptions() + + if args: # watcher doesn't take any arguments + print >> sys.stderr, ("Usage: %s [-f] " % sys.argv[0]) + sys.exit(constants.EXIT_FAILURE) utils.SetupLogging(constants.LOG_WATCHER, debug=options.debug, stderr_logging=options.debug)