From: Kefu Chai Date: Thu, 2 May 2019 15:17:29 +0000 (+0800) Subject: pybind/mgr: convert str to int using "int()" X-Git-Tag: v15.1.0~2691^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e484413dbde67d3dabb707750ff48232c0ba331f;p=ceph.git pybind/mgr: convert str to int using "int()" 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 --- diff --git a/src/pybind/mgr/insights/module.py b/src/pybind/mgr/insights/module.py index 21da24e11fb..616fc649d69 100644 --- a/src/pybind/mgr/insights/module.py +++ b/src/pybind/mgr/insights/module.py @@ -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))