From 366a2feaafa74190293c048a5db91cfccdc624ca Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 2 Nov 2021 11:21:19 -0400 Subject: [PATCH] Provide api for node to just fetch all it's attributes --- confluent_server/confluent/selfservice.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/confluent_server/confluent/selfservice.py b/confluent_server/confluent/selfservice.py index 0c3f08de..fe982602 100644 --- a/confluent_server/confluent/selfservice.py +++ b/confluent_server/confluent/selfservice.py @@ -108,6 +108,15 @@ def handle_request(env, start_response): # credential security results in user/password having to be deferred start_response('200 OK', (('Content-Type', retype),)) yield dumper(res) + elif env['PATH_INFO'] == '/self/myattribs': + cfd = cfg.get_node_attributes(nodename, '*').get(nodename, {}) + rsp = {} + for k in cfd: + if k.startswith('secret') or k.startswith('crypt') or 'value' not in cfd[k] or not cfd[k]['value']: + continue + rsp[k] = cfd[k]['value'] + start_response('200 OK', (('Conntent-Type', retype),)) + yield dumper(rsp) elif env['PATH_INFO'] == '/self/netcfg': myip = env.get('HTTP_X_FORWARDED_HOST', None) if ']' in myip: