Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions gmetad-python/plugins/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ def _parseConfig(self, cfgdata):
self.msci = self.api.msci

self.obj_cache = {}
tzoffset = datetime.utcfromtimestamp(-1).hour - datetime.fromtimestamp(0).hour + 1
if tzoffset == 24 :
tzoffset = 0
_now = int(time()) + (3600 * tzoffset)
self.last_refresh = str(_now)
self.last_refresh = str(time())

self.expid = self.api.cldshow(self.cloud_name, "time")["experiment_id"]
self.username = self.api.username
Expand Down Expand Up @@ -108,11 +104,7 @@ def find_object(self, ip, plugin, name) :
if verbose :
logging.debug("Should refresh returned true!")
plugin.obj_cache = {}
tzoffset = datetime.utcfromtimestamp(-1).hour - datetime.fromtimestamp(0).hour + 1
if tzoffset == 24 :
tzoffset = 0
_now = int(time()) + (3600 * tzoffset)
plugin.last_refresh = str(_now)
plugin.last_refresh = str(time())
if ip in plugin.obj_cache :
(exists, unused_obj) = plugin.obj_cache[ip]
if verbose :
Expand Down Expand Up @@ -228,13 +220,14 @@ def notify(self, clusterNode) :
empty = False

if not empty :
# epochs are already timezone-less. It's only the human timestamps that need to be corrected.
tzoffset = datetime.utcfromtimestamp(-1).hour - datetime.fromtimestamp(0).hour + 1
if tzoffset == 24 :
tzoffset = 0
_now = int(time()) + (3600 * tzoffset)
_data["time"] = time()
_now = int(_data["time"]) + (3600 * tzoffset)
_data["time_h"] = makeTimestamp(_now)
_data["time"] = _now
_data["latest_update"] = _now
_data["latest_update"] = _data["time"]

try :
if obj_type == "VM" :
Expand Down