Do mimimum to work with anydb.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
parent
20cdc46a94
commit
07e99ea570
@ -16,6 +16,9 @@
|
|||||||
import anydbm
|
import anydbm
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
class Dummy:
|
||||||
|
id = 0
|
||||||
|
|
||||||
def raw_template_get(context, template_id):
|
def raw_template_get(context, template_id):
|
||||||
return 'test return value'
|
return 'test return value'
|
||||||
|
|
||||||
@ -25,17 +28,12 @@ def raw_template_get_all(context):
|
|||||||
def raw_template_create(context, values):
|
def raw_template_create(context, values):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def parsed_template_get(context, template_id):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def parsed_template_get_all(context):
|
def parsed_template_get_all(context):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def parsed_template_create(context, values):
|
def parsed_template_create(context, values):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def state_get(context, state_id):
|
def state_get(context, state_id):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -45,6 +43,23 @@ def state_get_all(context):
|
|||||||
def state_create(context, values):
|
def state_create(context, values):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def resource_get(context, resource_id):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def resource_get_all(context):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def resource_create(context, values):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def stack_get(context, stack_id):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def stack_get_all(context):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def stack_create(context, values):
|
||||||
|
return Dummy()
|
||||||
|
|
||||||
def event_get(context, event_id):
|
def event_get(context, event_id):
|
||||||
pass
|
pass
|
||||||
@ -71,15 +86,15 @@ def event_create(context, event):
|
|||||||
EventId The unique ID of this event.
|
EventId The unique ID of this event.
|
||||||
Timestamp Time the status was updated.
|
Timestamp Time the status was updated.
|
||||||
'''
|
'''
|
||||||
name = event['StackName']
|
name = event['stack_name']
|
||||||
d = anydbm.open('/var/lib/heat/%s.events.db' % name, 'c')
|
d = anydbm.open('/var/lib/heat/%s.events.db' % name, 'c')
|
||||||
if d.has_key('lastid'):
|
if d.has_key('lastid'):
|
||||||
newid = int(d['lastid']) + 1
|
newid = int(d['lastid']) + 1
|
||||||
else:
|
else:
|
||||||
newid = 1
|
newid = 1
|
||||||
event['EventId'] = '%d' % newid
|
event['event_id'] = '%d' % newid
|
||||||
d['lastid'] = event['EventId']
|
d['lastid'] = event['event_id']
|
||||||
d[event['EventId']] = json.dumps(event)
|
d[event['event_id']] = json.dumps(event)
|
||||||
|
|
||||||
d.close()
|
d.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user