From 4647977598bfb6d3df92b08e62ae9bfce44dd9dc Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Wed, 22 Jul 2009 18:07:54 +0100 Subject: [PATCH] noded: Abstract hard-coded sys.exit value On machines without the ssl file noded exists '5'. Changing this to constants.EXIT_NOTCLUSTER. Also utils.GetNodeDaemonPort hasn't risen errors.ConfigurationError for a while, so removing that try/except block. Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- daemons/ganeti-noded | 8 ++------ lib/constants.py | 1 + 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index 9600e30ec..8b1007614 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -754,13 +754,9 @@ def main(): for fname in (constants.SSL_CERT_FILE,): if not os.path.isfile(fname): print "config %s not there, will not run." % fname - sys.exit(5) + sys.exit(constants.EXIT_NOTCLUSTER) - try: - port = utils.GetNodeDaemonPort() - except errors.ConfigurationError, err: - print "Cluster configuration incomplete: '%s'" % str(err) - sys.exit(5) + port = utils.GetNodeDaemonPort() dirs = [(val, constants.RUN_DIRS_MODE) for val in constants.SUB_RUN_DIRS] dirs.append((constants.LOG_OS_DIR, 0750)) diff --git a/lib/constants.py b/lib/constants.py index 05226c03f..9df5d7196 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -224,6 +224,7 @@ DDM_REMOVE = 'remove' # common exit codes EXIT_SUCCESS = 0 EXIT_FAILURE = 1 +EXIT_NOTCLUSTER = 5 EXIT_NOTMASTER = 11 EXIT_NODESETUP_ERROR = 12 EXIT_CONFIRMATION = 13 # need user confirmation -- GitLab