Revision 25ce3ec4 lib/objects.py
b/lib/objects.py | ||
---|---|---|
1466 | 1466 |
] |
1467 | 1467 |
|
1468 | 1468 |
|
1469 |
class InstanceConsole(ConfigObject): |
|
1470 |
"""Object describing how to access the console of an instance. |
|
1471 |
|
|
1472 |
""" |
|
1473 |
__slots__ = [ |
|
1474 |
"instance", |
|
1475 |
"kind", |
|
1476 |
"message", |
|
1477 |
"host", |
|
1478 |
"port", |
|
1479 |
"user", |
|
1480 |
"command", |
|
1481 |
"display", |
|
1482 |
] |
|
1483 |
|
|
1484 |
def Validate(self): |
|
1485 |
"""Validates contents of this object. |
|
1486 |
|
|
1487 |
""" |
|
1488 |
assert self.kind in constants.CONS_ALL, "Unknown console type" |
|
1489 |
assert self.instance, "Missing instance name" |
|
1490 |
assert self.message or self.kind in [constants.CONS_SSH, constants.CONS_VNC] |
|
1491 |
assert self.host or self.kind == constants.CONS_MESSAGE |
|
1492 |
assert self.port or self.kind in [constants.CONS_MESSAGE, |
|
1493 |
constants.CONS_SSH] |
|
1494 |
assert self.user or self.kind in [constants.CONS_MESSAGE, |
|
1495 |
constants.CONS_VNC] |
|
1496 |
assert self.command or self.kind in [constants.CONS_MESSAGE, |
|
1497 |
constants.CONS_VNC] |
|
1498 |
assert self.display or self.kind in [constants.CONS_MESSAGE, |
|
1499 |
constants.CONS_SSH] |
|
1500 |
return True |
|
1501 |
|
|
1502 |
|
|
1469 | 1503 |
class SerializableConfigParser(ConfigParser.SafeConfigParser): |
1470 | 1504 |
"""Simple wrapper over ConfigParse that allows serialization. |
1471 | 1505 |
|
Also available in: Unified diff