11import os
22import json
3+ import time
34from jsonschema import validate
45from .config import INSTANCES_PATH
56
2324 "state" : {"type" : "string" },
2425 "description" : {"type" : "string" }
2526 }
26- }
27+ },
28+ "last_modified_time" : {"type" : "number" }
2729 },
2830}
2931
@@ -37,6 +39,7 @@ def load_instance_meta(instance_id):
3739
3840
3941def dump_instance_meta (instance_id , data ):
42+ data ["last_modified_time " ] = time .time ()
4043 file = os .path .join (INSTANCES_PATH , instance_id , "instance.json" )
4144 validate (instance = data , schema = INSTANCE_META_SCHEMA )
4245 with open (file , "w" ) as f :
@@ -56,7 +59,8 @@ def dump_instance_meta(instance_id, data):
5659 "state" : {"type" : "string" },
5760 "description" : {"type" : "string" }
5861 }
59- }
62+ },
63+ "last_modified_time" : {"type" : "number" }
6064 }
6165}
6266
@@ -70,6 +74,7 @@ def load_binding_meta(instance_id):
7074
7175
7276def dump_binding_meta (instance_id , data ):
77+ data ["last_modified_time " ] = time .time ()
7378 file = os .path .join (INSTANCES_PATH , instance_id , "binding.json" )
7479 validate (instance = data , schema = INSTANCE_META_SCHEMA )
7580 with open (file , "w" ) as f :
0 commit comments