def CheckRapi(options, args): """Initial checks whether to run or exit with a failure. """ 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) # Read SSL certificate (this is a little hackish to read the cert as root) if options.ssl: options.ssl_params = http.HttpSslParams(ssl_key_path=options.ssl_key, ssl_cert_path=options.ssl_cert) else: options.ssl_params = None
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) try: options.uid = pwd.getpwnam(constants.MASTERD_USER).pw_uid options.gid = grp.getgrnam(constants.DAEMONS_GROUP).gr_gid except KeyError: print >> sys.stderr, ( "User or group not existing on system: %s:%s" % (constants.MASTERD_USER, constants.DAEMONS_GROUP)) sys.exit(constants.EXIT_FAILURE) # Determine static runtime architecture information runtime.InitArchInfo() # Check the configuration is sane before anything else try: livelock = utils.livelock.LiveLock("masterd_check") config.GetConfig(None, livelock) except errors.ConfigVersionMismatch, err: v1 = "%s.%s.%s" % version.SplitVersion(err.args[0]) v2 = "%s.%s.%s" % version.SplitVersion(err.args[1]) print >> sys.stderr, \ ("Configuration version mismatch. The current Ganeti software" " expects version %s, but the on-disk configuration file has" " version %s. This is likely the result of upgrading the" " software without running the upgrade procedure. Please contact" " your cluster administrator or complete the upgrade using the" " cfgupgrade utility, after reading the upgrade notes." % (v1, v2)) sys.exit(constants.EXIT_FAILURE)