]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Do mimimum to work with anydb.
authorAngus Salkeld <asalkeld@redhat.com>
Tue, 3 Apr 2012 06:27:27 +0000 (16:27 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Tue, 3 Apr 2012 06:27:27 +0000 (16:27 +1000)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
heat/db/anydbm/api.py

index 5f1be480cadc3831898786f8276140e7e68ef629..bc88d7057c7369e6f7acee77d6c3aeadc20abb5a 100644 (file)
@@ -16,6 +16,9 @@
 import anydbm
 import json
 
+class Dummy:
+    id = 0
+
 def raw_template_get(context, template_id):
     return 'test return value'
 
@@ -25,17 +28,12 @@ def raw_template_get_all(context):
 def raw_template_create(context, values):
     pass
 
-
-def parsed_template_get(context, template_id):
-    pass
-
 def parsed_template_get_all(context):
     pass
 
 def parsed_template_create(context, values):
     pass
 
-
 def state_get(context, state_id):
     pass
 
@@ -45,6 +43,23 @@ def state_get_all(context):
 def state_create(context, values):
     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):
     pass
@@ -71,15 +86,15 @@ def event_create(context, event):
     EventId    The unique ID of this event.
     Timestamp  Time the status was updated.
     '''
-    name = event['StackName']
+    name = event['stack_name']
     d = anydbm.open('/var/lib/heat/%s.events.db' % name, 'c')
     if d.has_key('lastid'):
         newid = int(d['lastid']) + 1
     else:
         newid = 1
-    event['EventId'] = '%d' % newid
-    d['lastid'] = event['EventId']
-    d[event['EventId']] = json.dumps(event)
+    event['event_id'] = '%d' % newid
+    d['lastid'] = event['event_id']
+    d[event['event_id']] = json.dumps(event)
 
     d.close()