Revision 13998ef2 lib/backend.py
b/lib/backend.py | ||
---|---|---|
51 | 51 |
from ganeti import ssconf |
52 | 52 |
|
53 | 53 |
|
54 |
_BOOT_ID_PATH = "/proc/sys/kernel/random/boot_id" |
|
55 |
|
|
56 |
|
|
54 | 57 |
class RPCFail(Exception): |
55 | 58 |
"""Class denoting RPC failure. |
56 | 59 |
|
... | ... | |
58 | 61 |
|
59 | 62 |
""" |
60 | 63 |
|
64 |
|
|
61 | 65 |
def _Fail(msg, *args, **kwargs): |
62 | 66 |
"""Log an error and the raise an RPCFail exception. |
63 | 67 |
|
... | ... | |
364 | 368 |
try: |
365 | 369 |
priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.GANETI_RUNAS) |
366 | 370 |
|
367 |
f = open(pub_key, 'r') |
|
368 |
try: |
|
369 |
utils.RemoveAuthorizedKey(auth_keys, f.read(8192)) |
|
370 |
finally: |
|
371 |
f.close() |
|
371 |
utils.RemoveAuthorizedKey(auth_keys, utils.ReadFile(pub_key)) |
|
372 | 372 |
|
373 | 373 |
utils.RemoveFile(priv_key) |
374 | 374 |
utils.RemoveFile(pub_key) |
... | ... | |
406 | 406 |
if hyp_info is not None: |
407 | 407 |
outputarray.update(hyp_info) |
408 | 408 |
|
409 |
f = open("/proc/sys/kernel/random/boot_id", 'r') |
|
410 |
try: |
|
411 |
outputarray["bootid"] = f.read(128).rstrip("\n") |
|
412 |
finally: |
|
413 |
f.close() |
|
409 |
outputarray["bootid"] = utils.ReadFile(_BOOT_ID_PATH, size=128).rstrip("\n") |
|
414 | 410 |
|
415 | 411 |
return outputarray |
416 | 412 |
|
Also available in: Unified diff