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

ConfigWriter: create the default node group


If no node groups exist we'll create a new default empty one.

Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 3df43542
No related branches found
No related tags found
No related merge requests found
......@@ -1272,6 +1272,15 @@ class ConfigWriter:
if item.uuid is None:
item.uuid = self._GenerateUniqueID(_UPGRADE_CONFIG_JID)
modified = True
if not self._config_data.nodegroups:
default_nodegroup_uuid = self._GenerateUniqueID(_UPGRADE_CONFIG_JID)
default_nodegroup = objects.NodeGroup(
uuid=default_nodegroup_uuid,
name="default",
members=[],
)
self._config_data.nodegroups[default_nodegroup_uuid] = default_nodegroup
modified = True
if modified:
self._WriteConfig()
# This is ok even if it acquires the internal lock, as _UpgradeConfig is
......
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