2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Include some feedback in rest explorer on input data

This commit is contained in:
Jarrod Johnson 2013-11-03 09:05:50 -05:00
parent ef3c8cd0c8
commit 51c80cdd74
2 changed files with 10 additions and 5 deletions

View File

@ -229,17 +229,22 @@ def resourcehandler(env, start_response):
return
start_response('200 OK', headers)
if mimetype == 'text/html':
for datum in _assemble_html(hdlr, resource):
for datum in _assemble_html(hdlr, resource, querydict):
yield datum
else:
for datum in _assemble_json(hdlr, resource):
yield datum
def _assemble_html(responses, resource):
def _assemble_html(responses, resource, querydict):
yield '<html><head><title>'
yield 'Confluent REST Explorer: ' + resource + '</title></head>'
yield '<body><form action="' + resource + '" method="post">'
if querydict:
yield 'Response to input data:<br>'
yield json.dumps(querydict, separators=(',', ': '),
indent=4, sort_keys=True)
yield '<hr>'
yield 'Only values that have their'
yield 'respective values honored by the confluent server.<hr>'
yield '<input type="hidden" name="restexplorerop" value="update">'

View File

@ -259,9 +259,9 @@ class IpmiHandler(object):
elif 'update' == self.op:
self.call_ipmicmd(self.ipmicmd.set_power, self.inputdata['powerstate'])
power = self.call_ipmicmd(self.ipmicmd.get_power)
print repr(power)
return msg.PowerState(node=self.node,
state=power['powerstate'])
def create(nodes, element, configmanager, inputdata):
if element == '_console/session':
@ -272,7 +272,7 @@ def create(nodes, element, configmanager, inputdata):
return IpmiIterator('update', nodes, element, configmanager, inputdata)
def update(nodes, element, configmanager, inputdata):
create(nodes, element, configmanager, inputdata)
return create(nodes, element, configmanager, inputdata)