mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-29 04:50:21 +00:00
Have confetty interactive attribute show be more informative
This commit is contained in:
parent
70b7b62c0f
commit
f6ed5b5e14
23
bin/confetty
23
bin/confetty
@ -192,15 +192,28 @@ def do_command(command, server):
|
||||
print item["href"]
|
||||
else: # generic attributes to list
|
||||
for key in res.iterkeys():
|
||||
notes = []
|
||||
if res[key] is None:
|
||||
print "%s=" % key
|
||||
elif 'value' in res[key]:
|
||||
print "%s=%s" % (key, res[key]['value'])
|
||||
attrstr = '%s=""' % key
|
||||
elif type(res[key]) == list:
|
||||
attrstr = '%s=["%s"]' % (key, '","'.join(res[key]))
|
||||
elif 'value' in res[key] and res[key]['value'] is not None:
|
||||
attrstr = '%s="%s"' % (key, res[key]['value'])
|
||||
elif 'value' in res[key] and res[key]['value'] is None:
|
||||
attrstr = '%s=""' % key
|
||||
else:
|
||||
if 'isset' in res[key] and res[key]['isset']:
|
||||
print "%s=********" % key
|
||||
attrstr = '%s="********"' % key
|
||||
else:
|
||||
print "%s=" % key
|
||||
attrstr = '%s=""' % key
|
||||
if res[key] is not None and 'inheritedfrom' in res[key]:
|
||||
notes.append('Inherited from %s' % res[key]['inheritedfrom'])
|
||||
if res[key] is not None and 'expression' in res[key]:
|
||||
notes.append('Derived from expression "%s"' % res[key]['expression'])
|
||||
notestr = '(' + ', '.join(notes) + ')'
|
||||
output = '{0:<40} {1:>39}'.format(attrstr, notestr)
|
||||
print output
|
||||
|
||||
elif argv[0] == 'start':
|
||||
targpath = fullpath_target(argv[1])
|
||||
currconsole = targpath
|
||||
|
@ -35,8 +35,13 @@ class ConfluentMessage(object):
|
||||
val = self.kvpairs[key]
|
||||
value = self.defaultvalue
|
||||
type = self.defaulttype
|
||||
notes = []
|
||||
if val is not None and 'value' in val:
|
||||
value = val['value']
|
||||
if 'inheritedfrom' in val:
|
||||
notes.append('Inherited from %s' % val['inheritedfrom'])
|
||||
if 'expression' in val:
|
||||
notes.append('Derived from expression "%s"' % val['expression'])
|
||||
elif val is not None and 'expression' in val:
|
||||
value = val['expression']
|
||||
if value is None:
|
||||
@ -44,6 +49,8 @@ class ConfluentMessage(object):
|
||||
if val is not None and value == '' and 'isset' in val and val['isset'] is True:
|
||||
# an encrypted value, put some *** to show it is set
|
||||
# in the explorer
|
||||
if 'inheritedfrom' in val:
|
||||
notes.append('Inherited from %s' % val['inheritedfrom'])
|
||||
value = '********'
|
||||
if isinstance(val, list):
|
||||
snippet += key + ":"
|
||||
@ -65,6 +72,8 @@ class ConfluentMessage(object):
|
||||
'title="{3}"><input type="checkbox" '
|
||||
'name="restexplorerhonorkey" value="{1}">'
|
||||
).format(type, key, value, self.desc)
|
||||
if len(notes) > 0:
|
||||
snippet += '(' + ','.join(notes) + ')'
|
||||
return snippet
|
||||
|
||||
|
||||
@ -314,6 +323,7 @@ class CryptedAttributes(Attributes):
|
||||
try:
|
||||
if kv[key] is not None and kv[key]['cryptvalue'] != '':
|
||||
nkv[key] = {'isset': True}
|
||||
nkv[key]['inheritedfrom'] = kv[key]['inheritedfrom']
|
||||
except KeyError:
|
||||
pass
|
||||
if node is None:
|
||||
|
@ -104,7 +104,7 @@ def retrieve_nodes(nodes, element, configmanager, inputdata):
|
||||
desc = 'Unknown'
|
||||
if 'value' in currattr:
|
||||
yield msg.Attributes(node,
|
||||
{attribute: currattr['value']},
|
||||
{attribute: currattr},
|
||||
desc)
|
||||
elif 'cryptvalue' in currattr:
|
||||
yield msg.CryptedAttributes(node,
|
||||
|
Loading…
Reference in New Issue
Block a user