summaryrefslogtreecommitdiff
path: root/azurelinuxagent/common/errorstate.py
diff options
context:
space:
mode:
authorƁukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com>2018-02-15 14:28:59 +0100
committerusd-importer <ubuntu-server@lists.ubuntu.com>2018-02-15 19:08:29 +0000
commit3afbcfff2f6e3faf50c0dffee55e7c48b50755b5 (patch)
tree44d4a5d80868fe6a8defe57f6cc9c21feae59a03 /azurelinuxagent/common/errorstate.py
parent6c9cd7e1ac55aae259d8e2f06569375e27a12f20 (diff)
parent7e7d885433a2bac56ce2361126bf7ec3d565fd66 (diff)
downloadvyos-walinuxagent-3afbcfff2f6e3faf50c0dffee55e7c48b50755b5.tar.gz
vyos-walinuxagent-3afbcfff2f6e3faf50c0dffee55e7c48b50755b5.zip
Import patches-applied version 2.2.21+really2.2.20-0ubuntu1~16.04.1 to applied/ubuntu/xenial-proposed
Imported using git-ubuntu import. Changelog parent: 6c9cd7e1ac55aae259d8e2f06569375e27a12f20 Unapplied parent: 7e7d885433a2bac56ce2361126bf7ec3d565fd66 New changelog entries: * Backport bionic version to xenial. * Revert to an older upstream release: 2.2.20 (LP: #1749589). - Rename upstream tarball to 2.2.21+really2.2.20 to end up with a temporarily higher version number than what's in the archive. * debian/patches/disable_import_test.patch: refreshed patch.
Diffstat (limited to 'azurelinuxagent/common/errorstate.py')
-rw-r--r--azurelinuxagent/common/errorstate.py31
1 files changed, 0 insertions, 31 deletions
diff --git a/azurelinuxagent/common/errorstate.py b/azurelinuxagent/common/errorstate.py
deleted file mode 100644
index 750aa77..0000000
--- a/azurelinuxagent/common/errorstate.py
+++ /dev/null
@@ -1,31 +0,0 @@
-from datetime import datetime, timedelta
-
-ERROR_STATE_DELTA = timedelta(minutes=15)
-
-
-class ErrorState(object):
- def __init__(self, min_timedelta = ERROR_STATE_DELTA):
- self.min_timedelta = min_timedelta
-
- self.count = 0
- self.timestamp = None
-
- def incr(self):
- if self.count == 0:
- self.timestamp = datetime.utcnow()
-
- self.count += 1
-
- def reset(self):
- self.count = 0
- self.timestamp = None
-
- def is_triggered(self):
- if self.timestamp is None:
- return False
-
- delta = datetime.utcnow() - self.timestamp
- if delta >= self.min_timedelta:
- return True
-
- return False