]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
fix python collections module warning for v3.7 and above
authorGanesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
Mon, 29 Oct 2018 06:29:45 +0000 (23:29 -0700)
committerGanesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
Mon, 29 Oct 2018 06:32:22 +0000 (23:32 -0700)
Python 3.7 now shows a warning as below.

/usr/bin/ceph:128: DeprecationWarning: Using or importing the ABCs from
'collections' instead of from 'collections.abc' is deprecated, and in
3.8 it will stop working
  import rados

This patch addresses the that particular issue.

Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
19 files changed:
qa/tasks/cephfs/test_data_scan.py
qa/tasks/cephfs/test_forward_scrub.py
qa/tasks/cephfs/test_recovery_pool.py
qa/tasks/cephfs/test_scrub.py
qa/tasks/mgr/dashboard/helper.py
qa/tasks/vstart_runner.py
src/ceph-volume/ceph_volume/__init__.py
src/pybind/ceph_daemon.py
src/pybind/cephfs/cephfs.pyx
src/pybind/mgr/dashboard/controllers/cephfs.py
src/pybind/mgr/dashboard/services/ceph_service.py
src/pybind/mgr/mgr_module.py
src/pybind/mgr/restful/api/crush.py
src/pybind/mgr/status/module.py
src/pybind/mgr/telemetry/module.py
src/pybind/rados/rados.pyx
src/pybind/rbd/rbd.pyx
src/pybind/rgw/rgw.pyx
src/tools/rgw/parse-cr-dump.py

index 0faeb43fc03f3df631105464ee84f2c3b7d86f2e..478d2a12a652f50e3a04d737308f8cff4a015363 100644 (file)
@@ -8,7 +8,10 @@ import logging
 import os
 from textwrap import dedent
 import traceback
-from collections import namedtuple, defaultdict
+try:
+    from collections.abc import namedtuple, defaultdict
+except ImportError:
+    from collections import namedtuple, defaultdict
 
 from teuthology.orchestra.run import CommandFailedError
 from tasks.cephfs.cephfs_test_case import CephFSTestCase, for_teuthology
index e165780f31f188641fd527474e7155482bc14c6a..6150dbaea4a1642437d4f13fca6acccd967c12c3 100644 (file)
@@ -10,7 +10,10 @@ how the functionality responds to damaged metadata.
 import json
 
 import logging
-from collections import namedtuple
+try:
+    from collections.abc import namedtuple
+except ImportError:
+    from collections import namedtuple
 from textwrap import dedent
 
 from teuthology.orchestra.run import CommandFailedError
index 97049b9c0a3374af448c708d1d34370380f3a8ab..41fd512f1188726ff9fd13f7a14086498c87bc65 100644 (file)
@@ -8,7 +8,10 @@ import logging
 import os
 from textwrap import dedent
 import traceback
-from collections import namedtuple, defaultdict
+try:
+    from collections.abc import namedtuple, defaultdict
+except ImportError:
+    from collections import namedtuple, defaultdict
 
 from teuthology.orchestra.run import CommandFailedError
 from tasks.cephfs.cephfs_test_case import CephFSTestCase, for_teuthology
index 9469dfce6e4939edd926890eda96b8f43465cb0a..4cc4f7f0c94b0444d416598d3b94f179c2b1659a 100644 (file)
@@ -4,7 +4,10 @@ Test CephFS scrub (distinct from OSD scrub) functionality
 import logging
 import os
 import traceback
-from collections import namedtuple
+try:
+    from collections.abc import namedtuple
+except ImportError:
+    from collections import namedtuple
 
 from teuthology.orchestra.run import CommandFailedError
 from tasks.cephfs.cephfs_test_case import CephFSTestCase, for_teuthology
index f9c86516bf57c3c9d5e0790fdb6aa8f7a00d5b48..cdf294329cd3b75f35e55f38d5432cce76b72330 100644 (file)
@@ -4,7 +4,10 @@ from __future__ import absolute_import
 
 import json
 import logging
-from collections import namedtuple
+try:
+    from collections.abc import namedtuple
+except ImportError:
+    from collections import namedtuple
 import threading
 import time
 
index bf54af4921938ff11bdce3e3ca650bbb3cea29db..8afafb59eebff4d3964ede432fe2367cf95a90a4 100644 (file)
@@ -26,7 +26,10 @@ Alternative usage:
 """
 
 from StringIO import StringIO
-from collections import defaultdict
+try:
+    from collections.abc import defaultdict
+except ImportError:
+    from collections import defaultdict
 import getpass
 import signal
 import tempfile
index 640fb1e6fb1512bcf239c4c41dc2c2851335946e..fd997eea7089cf91839cd578d9949d9c2bf6ae24 100644 (file)
@@ -1,4 +1,7 @@
-from collections import namedtuple
+try:
+    from collections.abc import namedtuple
+except ImportError:
+    from collections import namedtuple
 
 
 sys_info = namedtuple('sys_info', ['devices'])
index b1c5750f3bdc748d68237e15c57a3d9d4459d3cf..9b55613f5d9b090340783848c82b80a19295c545 100644 (file)
@@ -15,7 +15,10 @@ import json
 import socket
 import struct
 import time
-from collections import OrderedDict
+try:
+    from collections.abc import OrderedDict
+except ImportError:
+    from collections import OrderedDict
 from fcntl import ioctl
 from fnmatch import fnmatch
 from prettytable import PrettyTable, HEADER
index 5f6ee6562b1fc366f41dde4365f6f253a4193016..2fb748090cbab94836f310ce974c839b6e97583b 100644 (file)
@@ -9,7 +9,10 @@ from libc.stdlib cimport malloc, realloc, free
 
 cimport rados
 
-from collections import namedtuple
+try:
+    from collections.abc import namedtuple
+except ImportError:
+    from collections import namedtuple
 from datetime import datetime
 import errno
 import os
index df31d4a4f36eb2d9fb303c5167378159a24973fc..d481e493e7ec4e07db45666773cee89f79edc4be 100644 (file)
@@ -1,7 +1,10 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import
 
-from collections import defaultdict
+try:
+    from collections.abc import defaultdict
+except ImportError:
+    from collections import defaultdict
 
 import cherrypy
 
index 91b4f351ef6e7cd7d081753b18cfad05f5c265bc..b0bec642a1a2ab7cc8206bae21727242e590796a 100644 (file)
@@ -2,8 +2,12 @@
 from __future__ import absolute_import
 
 import time
-import collections
-from collections import defaultdict
+try:
+    import collections.abc
+    from collections.abc import defaultdict
+except ImportError:
+    import collections
+    from collections import defaultdict
 import json
 
 import rados
index 3c9510fbdabb7c36e1bd7ecf37ce914cb6ddce1f..b96886a2579a411c36f4d36a9f04c114c5cf4a0e 100644 (file)
@@ -4,7 +4,10 @@ import ceph_module  # noqa
 import logging
 import six
 import threading
-from collections import defaultdict
+try:
+    from collections.abc import defaultdict
+except ImportError:
+    from collections import defaultdict
 import rados
 
 PG_STATES = [
index ee8589df0a41ae4abcdf307731b64481361c14e1..6b2b3646cf9610048ab28a1516d5e5a5c6c24bc1 100644 (file)
@@ -2,7 +2,10 @@ from pecan import expose
 from pecan.rest import RestController
 
 from restful import common, context
-from collections import defaultdict
+try:
+    from collections.abc import defaultdict
+except ImportError:
+    from collections import defaultdict
 
 from restful.decorators import auth
 
index 99d3c7103d5bac22708fd66923d3be3e399fd4ff..7a4f72cb3cdb31130b53818d3541ded6144fb51d 100644 (file)
@@ -3,7 +3,10 @@
 High level status display commands
 """
 
-from collections import defaultdict
+try:
+    from collections.abc import defaultdict
+except ImportError:
+    from collections import defaultdict
 from prettytable import PrettyTable
 import errno
 import fnmatch
index f331e1825326b1725ac25d96d18ff627d5004b0e..d20b24979b55c701e6a7ff84a94e9e23a31201a3 100644 (file)
@@ -12,7 +12,10 @@ import uuid
 import time
 from datetime import datetime
 from threading import Event
-from collections import defaultdict
+try:
+    from collections.abc import defaultdict
+except ImportError:
+    from collections import defaultdict
 
 from mgr_module import MgrModule
 
index fa60b87be0ee6f2043663989a6030741a1d9926e..6b3a0e858713b8b29de7c25d952c553db708f088 100644 (file)
@@ -23,7 +23,10 @@ import sys
 import threading
 import time
 
-from collections import Callable
+try:
+    from collections.abc import Callable
+except ImportError:
+    from collections import Callable
 from datetime import datetime
 from functools import partial, wraps
 from itertools import chain
index b300edd0d1a38793b80466c02c5c16fec0cbf011..240aac9af5b9b0ef319e1b822dd3755698ae6eff 100644 (file)
@@ -23,7 +23,10 @@ from libc.stdint cimport *
 from libc.stdlib cimport realloc, free
 from libc.string cimport strdup
 
-from collections import Iterable
+try:
+    from collections.abc import Iterable
+except ImportError:
+    from collections import Iterable
 from datetime import datetime
 
 cimport rados
index f512d33f84ab9ed80f86d5caa64067faf0134192..39476aac86f87b6334d6349a169e1c269d867235 100644 (file)
@@ -10,7 +10,10 @@ from libc.stdlib cimport malloc, realloc, free
 
 cimport rados
 
-from collections import namedtuple
+try:
+    from collections.abc import namedtuple
+except ImportError:
+    from collections import namedtuple
 from datetime import datetime
 import errno
 
index 539929b113d87aab22065e97fd8632d86d27c8ad..e979cf33ec8fdd7984732e5d6c12e01bef1ad13b 100755 (executable)
@@ -1,6 +1,9 @@
 #!/usr/bin/python
 from __future__ import print_function
-from collections import Counter
+try:
+    from collections.abc import Counter
+except ImportError:
+    from collections import Counter
 import argparse
 import json
 import re