]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr: convert str to int using "int()" 27926/head
authorKefu Chai <kchai@redhat.com>
Thu, 2 May 2019 15:17:29 +0000 (23:17 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 2 May 2019 15:17:31 +0000 (23:17 +0800)
on python3, integers are of unlimited size. while on python2, "long"
integers have unlimited size.

Fixes: https://tracker.ceph.com/issues/38627
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/insights/module.py

index 21da24e11fb0bea6e161d2194d0172c7921d2b7d..616fc649d6954c4d8289523fb0142dfc5a0302dc 100644 (file)
@@ -307,7 +307,10 @@ class Module(MgrModule):
         the selftest module to manage testing scenarios related to tracking
         health history.
         """
-        hours = long(hours)
+        try:
+            hours = long(hours)
+        except NameError:
+            hours = int(hours)
         health_util.NOW_OFFSET = datetime.timedelta(hours = hours)
         self.log.warning("Setting now time offset {}".format(health_util.NOW_OFFSET))