diff --git a/confluent/config/attributes.py b/confluent/config/attributes.py index f7a9c1e3..72abc999 100644 --- a/confluent/config/attributes.py +++ b/confluent/config/attributes.py @@ -57,12 +57,12 @@ node = { 'description': ('List of static groups for which this node is' 'considered a member'), }, - 'type': { - 'description': ('Classification of node as system, vm, etc') - }, - 'id': { - 'description': ('Numeric identifier for node') - }, + #'type': { + # 'description': ('Classification of node as system, vm, etc') + #}, + #'id': { + # 'description': ('Numeric identifier for node') + #}, # 'location.timezone': { # 'description': 'POSIX timezone to apply to this node', # }, diff --git a/confluent/httpapi.py b/confluent/httpapi.py index dece786a..357fe81e 100644 --- a/confluent/httpapi.py +++ b/confluent/httpapi.py @@ -6,6 +6,7 @@ import base64 import Cookie import confluent.auth as auth +import confluent.config.attributes as attribs import confluent.consoleserver as consoleserver import confluent.exceptions as exc import confluent.messages @@ -31,6 +32,22 @@ opmap = { 'DELETE': 'delete', } +def node_creation_resources(): + yield confluent.messages.Attributes( + kv={ 'name': None}, desc="Name of the node").html() + '
' + for attr in sorted(attribs.node.iterkeys()): + if attr.startswith("secret."): + yield confluent.messages.CryptedAttributes( + kv={ attr: None }, desc=attribs.node[attr]['description']).html() + \ + '
' + else: + yield confluent.messages.Attributes( + kv={ attr: None }, desc=attribs.node[attr]['description']).html() + \ + '
' + +create_resource_functions = { + '/node/': node_creation_resources, +} def _sessioncleaner(): while (1): @@ -248,7 +265,7 @@ def resourcehandler(env, start_response): def _assemble_html(responses, resource, querydict, url): yield '' \ - 'Confluent REST Explorer: ' + resource + '' \ + 'Confluent REST Explorer: ' + url + '' \ '
' if querydict: yield 'Response to input data:
' + \ @@ -275,8 +292,19 @@ def _assemble_html(responses, resource, querydict, url): pendingrsp.append(rsp) for rsp in pendingrsp: yield rsp.html()+ "
" - print url - if not iscollection: + if iscollection: + localpath = url[:-2] + try: + firstpass = True + for y in create_resource_functions[url](): + if firstpass: + yield "
Define new %s:
" % url.split("/")[-2] + firstpass = False + yield y + yield '
' + except KeyError: + pass + else: yield '' diff --git a/confluent/messages.py b/confluent/messages.py index 42acb9ea..dfe76d47 100644 --- a/confluent/messages.py +++ b/confluent/messages.py @@ -35,25 +35,31 @@ class ConfluentMessage(object): value = self.defaultvalue note = '' type = self.defaulttype + try: + desc = self.desc + except: + desc = '' if 'value' in val: value = val['value'] + if value is None: + value = '' if 'note' in val: note = '(' + val['note'] + ')' if isinstance(val, list): snippet += key + ":" for v in val: snippet += \ - '%s' % ( - type, key, v, note) + '%s' % ( + type, key, v, desc, note) snippet += \ - '%s' % ( - type, key, note) + '%s' % ( + type, key, desc, note) snippet += '%s' % ( - type, key, value, note) + '%s' % ( + type, key, value, desc, note) snippet += '