Revision 1c69ad80 lib/ssconf.py
b/lib/ssconf.py | ||
---|---|---|
497 | 497 |
if debug: |
498 | 498 |
sys.stderr.write("Not master, exiting.\n") |
499 | 499 |
sys.exit(constants.EXIT_NOTMASTER) |
500 |
|
|
501 |
|
|
502 |
def CheckMasterCandidate(debug, ss=None): |
|
503 |
"""Checks the node setup. |
|
504 |
|
|
505 |
If this is a master candidate, the function will return. Otherwise it will |
|
506 |
exit with an exit code based on the node status. |
|
507 |
|
|
508 |
""" |
|
509 |
try: |
|
510 |
if ss is None: |
|
511 |
ss = SimpleStore() |
|
512 |
myself = utils.HostInfo().name |
|
513 |
candidates = ss.GetMasterCandidates() |
|
514 |
except errors.ConfigurationError, err: |
|
515 |
print "Cluster configuration incomplete: '%s'" % str(err) |
|
516 |
sys.exit(constants.EXIT_NODESETUP_ERROR) |
|
517 |
except errors.ResolverError, err: |
|
518 |
sys.stderr.write("Cannot resolve my own name (%s)\n" % err.args[0]) |
|
519 |
sys.exit(constants.EXIT_NODESETUP_ERROR) |
|
520 |
|
|
521 |
if myself not in candidates: |
|
522 |
if debug: |
|
523 |
sys.stderr.write("Not master candidate, exiting.\n") |
|
524 |
sys.exit(constants.EXIT_NOTCANDIDATE) |
Also available in: Unified diff