2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-02-28 08:11:45 +00:00

Fix for crypted handling

Crypted attributes were not
handled well, fix the mistakes.
This commit is contained in:
Jarrod Johnson 2020-04-16 16:54:59 -04:00
parent 16667ed41c
commit dc2df09c4e
2 changed files with 6 additions and 5 deletions

View File

@ -1798,11 +1798,12 @@ class CryptedAttributes(Attributes):
nkv = {}
for key in kv:
nkv[key] = {'isset': False}
if 'hashvalue' in kv[key]:
targkey = 'hashvalue'
else:
targkey = 'cryptvalue'
try:
if kv[key] is not None and kv[key]['cryptvalue'] != '':
nkv[key] = {'isset': True}
nkv[key]['inheritedfrom'] = kv[key]['inheritedfrom']
elif kv[key] is not None and kv[key]['hashvalue'] != '':
if kv[key] is not None and kv[key][targkey] != '':
nkv[key] = {'isset': True}
nkv[key]['inheritedfrom'] = kv[key]['inheritedfrom']
except KeyError:

View File

@ -142,7 +142,7 @@ def retrieve_nodes(nodes, element, configmanager, inputdata):
desc = ''
if 'value' in currattr or 'expression' in currattr:
yield msg.Attributes(node, {attribute: currattr}, desc)
elif 'cryptvalue' in currattr:
elif 'cryptvalue' in currattr or 'hashvalue' in currattr:
yield msg.CryptedAttributes(
node, {attribute: currattr}, desc)
elif isinstance(currattr, list):