2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-16 12:47:50 +00:00

Fix use of multi dot attributes in expressions

It was formerly only assuming ability to bisect, now recurse to get the
string out of nested attributes.
This commit is contained in:
Jarrod Johnson 2018-01-26 14:29:22 -05:00
parent 7ea99ecbf5
commit 68d469788d

View File

@ -416,9 +416,14 @@ class _ExpressionFormat(string.Formatter):
return node.n
elif isinstance(node, ast.Attribute):
#ok, we have something with a dot
left = node.value.id
right = node.attr
key = left + '.' + right
left = node
key = ''
while isinstance(left, ast.Attribute):
# Loop through, to handle multi dot expressions
# such as 'net.pxe.hwaddr'
key = '.' + left.attr + key
left = left.value
key = left.id + key
val = self._expand_attribute(key)
return val['value'] if val and 'value' in val else ""
elif isinstance(node, ast.Name):