2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-15 04:07:51 +00:00

Add configmanager function to clear attribute.

When a caller requests to clear an attribute, if attribute is there
and not inherited, it is deleted and then groups are searched for
backfill.
This commit is contained in:
Jarrod Johnson 2014-02-19 19:36:25 -05:00
parent b823bc37d2
commit 88a55b8942

View File

@ -602,6 +602,20 @@ class ConfigManager(object):
del self._cfgstore['groups'][group]
self._bg_sync_to_file()
def clear_node_attributes(self, nodes, attributes):
for node in nodes:
try:
nodek = self._cfgstore['nodes'][node]
except KeyError:
continue
for attrib in attributes:
if attrib in nodek and 'inheritedfrom' not in nodek[attrib]:
# if the attribute is set and not inherited,
# delete it and check for inheritence to backfil data
del nodek[attrib]
self._do_inheritance(nodek, attrib)
self._bg_sync_to_file()
def set_node_attributes(self, attribmap):
if 'nodes' not in self._cfgstore:
self._cfgstore['nodes'] = {}