Skip to content
Snippets Groups Projects
Commit 37482e7b authored by Guido Trotter's avatar Guido Trotter
Browse files

Make the OS object able to represent broken OSes

Till now the OS object just represents a correct OS instance.  Change it so it
can represent a broken one too, by adding a "status" field: if this field is
different from the OS_VALID_STATUS constant the object is considered to be an
invalid OS, the "status" field to be a debugging message, and its boolean
status is set to false.

Reviewed-By: iustinp
parent 519bfbae
No related branches found
No related tags found
No related merge requests found
......@@ -130,6 +130,9 @@ LOCALHOST_IP_ADDRESS = "127.0.0.1"
TCP_PING_TIMEOUT = 10
GANETI_RUNAS = "root"
# valid os status
OS_VALID_STATUS = "VALID"
# ssh constants
SSH_INITD_SCRIPT = _autoconf.SSH_INITD_SCRIPT
SSH_CONFIG_DIR = "/etc/ssh/"
......
......@@ -589,6 +589,7 @@ class OS(ConfigObject):
__slots__ = [
"name",
"path",
"status",
"api_version",
"create_script",
"export_script",
......@@ -596,6 +597,10 @@ class OS(ConfigObject):
"rename_script",
]
def __nonzero__(self):
return self.status == constants.OS_VALID_STATUS
__bool__ = __nonzero__
class Node(TaggableObject):
"""Config object representing a node."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment