Add timestamp to nodeinfo in storage
Signed-off-by: martin f. krafft <madduck@madduck.net>
diff --git a/reclass/__init__.py b/reclass/__init__.py
index a2d9f97..162e1e8 100644
--- a/reclass/__init__.py
+++ b/reclass/__init__.py
@@ -7,8 +7,6 @@
# Released under the terms of the Artistic Licence 2.0
#
-import time
-import config
from output import OutputLoader
from storage import StorageBackendLoader
@@ -22,7 +20,6 @@
ret = storage.inventory()
else:
ret = storage.nodeinfo(node)
- ret['RECLASS']['timestamp'] = time.strftime('%c')
return ret
diff --git a/reclass/storage/__init__.py b/reclass/storage/__init__.py
index f6908d9..ad509bd 100644
--- a/reclass/storage/__init__.py
+++ b/reclass/storage/__init__.py
@@ -6,6 +6,12 @@
# Copyright © 2007–13 martin f. krafft <madduck@madduck.net>
# Released under the terms of the Artistic Licence 2.0
#
+
+import time
+
+def _get_timestamp():
+ return time.strftime('%c')
+
class NodeStorageBase(object):
def __init__(self, nodes_uri, classes_uri, applications_postfix):
@@ -21,7 +27,9 @@
def nodeinfo(self, node):
entity, uri = self._read_nodeinfo(node, self.nodes_uri, {})
- return {'RECLASS' : {'node': node, 'node_uri': uri},
+ return {'RECLASS' : {'node': node, 'node_uri': uri,
+ 'timestamp': _get_timestamp()
+ },
'classes': list(entity.classes),
'applications': list(entity.applications),
'parameters': dict(entity.parameters)