From 607bacace1780cb07838ba107cf5421a673e4158 Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Thu, 17 Nov 2016 12:22:47 +0530 Subject: [PATCH] Python 3 compatibility fixes. Signed-off-by: Aravinda VK --- gluster/cli/__init__.py | 28 ++++++++++++++-------------- gluster/cli/bitrot.py | 4 ++-- gluster/cli/bricks.py | 4 ++-- gluster/cli/georep.py | 6 +++--- gluster/cli/heal.py | 4 ++-- gluster/cli/nfs_ganesha.py | 2 +- gluster/cli/parsers.py | 6 +++--- gluster/cli/peer.py | 4 ++-- gluster/cli/quota.py | 4 ++-- gluster/cli/rebalance.py | 4 ++-- gluster/cli/snapshot.py | 8 ++++---- gluster/cli/tier.py | 4 ++-- gluster/cli/volume.py | 25 ++++++++++++------------- setup.py | 3 +++ 14 files changed, 54 insertions(+), 52 deletions(-) diff --git a/gluster/cli/__init__.py b/gluster/cli/__init__.py index c256c2d..27d2f17 100644 --- a/gluster/cli/__init__.py +++ b/gluster/cli/__init__.py @@ -9,22 +9,22 @@ # cases as published by the Free Software Foundation. # -__version__ = '0.1' +__version__ = '0.2' -import volume -import bitrot -import bricks -import georep -import peer -import quota -import snapshot -import heal -import nfs_ganesha -import rebalance -import tier +from . import volume +from . import bitrot +from . import bricks +from . import georep +from . import peer +from . import quota +from . import snapshot +from . import heal +from . import nfs_ganesha +from . import rebalance +from . import tier -from utils import (set_gluster_path, - GlusterCmdException) +from .utils import (set_gluster_path, + GlusterCmdException) # Reexport __all__ = ["volume", diff --git a/gluster/cli/bitrot.py b/gluster/cli/bitrot.py index bdb0a12..6c52251 100644 --- a/gluster/cli/bitrot.py +++ b/gluster/cli/bitrot.py @@ -8,8 +8,8 @@ # later), or the GNU General Public License, version 2 (GPLv2), in all # cases as published by the Free Software Foundation. # -from utils import bitrot_execute, bitrot_execute_xml, GlusterCmdException -from parsers import parse_bitrot_scrub_status +from .utils import bitrot_execute, bitrot_execute_xml, GlusterCmdException +from .parsers import parse_bitrot_scrub_status THROTTLE_TYPES = ["lazy", "normal", "aggressive"] FREQUENCY_TYPES = ["hourly", "daily", "weekly", "biweekly", "monthly"] diff --git a/gluster/cli/bricks.py b/gluster/cli/bricks.py index 3b3ac80..95f921f 100644 --- a/gluster/cli/bricks.py +++ b/gluster/cli/bricks.py @@ -8,8 +8,8 @@ # later), or the GNU General Public License, version 2 (GPLv2), in all # cases as published by the Free Software Foundation. # -from utils import volume_execute, volume_execute_xml -from parsers import parse_remove_brick_status +from .utils import volume_execute, volume_execute_xml +from .parsers import parse_remove_brick_status def add(volname, bricks, stripe=None, replica=None, arbiter=None, force=False): diff --git a/gluster/cli/georep.py b/gluster/cli/georep.py index c6e7646..6f0af73 100644 --- a/gluster/cli/georep.py +++ b/gluster/cli/georep.py @@ -8,9 +8,9 @@ # later), or the GNU General Public License, version 2 (GPLv2), in all # cases as published by the Free Software Foundation. # -from utils import georep_execute, georep_execute_xml, gluster_system_execute -from parsers import parse_georep_config, parse_georep_status -import volume +from .utils import georep_execute, georep_execute_xml, gluster_system_execute +from .parsers import parse_georep_config, parse_georep_status +from . import volume def gsec_create(ssh_key_prefix=True): diff --git a/gluster/cli/heal.py b/gluster/cli/heal.py index d223e90..6e4e342 100644 --- a/gluster/cli/heal.py +++ b/gluster/cli/heal.py @@ -8,8 +8,8 @@ # later), or the GNU General Public License, version 2 (GPLv2), in all # cases as published by the Free Software Foundation. # -from utils import heal_execute, heal_execute_xml, GlusterCmdException -from parsers import parse_heal_statistics, parse_heal_info +from .utils import heal_execute, heal_execute_xml, GlusterCmdException +from .parsers import parse_heal_statistics, parse_heal_info HEAL_INFO_TYPES = ["healed", "heal-failed", "split-brain"] diff --git a/gluster/cli/nfs_ganesha.py b/gluster/cli/nfs_ganesha.py index 37a1b1d..9c7c463 100644 --- a/gluster/cli/nfs_ganesha.py +++ b/gluster/cli/nfs_ganesha.py @@ -8,7 +8,7 @@ # later), or the GNU General Public License, version 2 (GPLv2), in all # cases as published by the Free Software Foundation. # -from utils import gluster_execute +from .utils import gluster_execute def enable(): diff --git a/gluster/cli/parsers.py b/gluster/cli/parsers.py index 5af78c7..181361d 100644 --- a/gluster/cli/parsers.py +++ b/gluster/cli/parsers.py @@ -332,7 +332,7 @@ def parse_georep_status(data, volinfo): out[-1].append(gstatus[session][bname]) else: # Offline Status - node, brick = bname.split(":") + node, brick_path = bname.split(":") if "@" not in slave: slave_user = "root" else: @@ -342,7 +342,7 @@ def parse_georep_status(data, volinfo): "mastervol": mvol, "slavevol": slave.split("::")[-1], "master_node": node, - "master_brick": brick, + "master_brick": brick_path, "slave_user": slave_user, "slave": slave, "slave_node": "N/A", @@ -353,7 +353,7 @@ def parse_georep_status(data, volinfo): "meta": "N/A", "failures": "N/A", "checkpoint_completed": "N/A", - "master_node_uuid": brick["hostUuid"], + "master_node_uuid": brick["uuid"], "last_synced": "N/A", "checkpoint_time": "N/A", "checkpoint_completion_time": "N/A" diff --git a/gluster/cli/peer.py b/gluster/cli/peer.py index e9d8d52..d34e0f7 100644 --- a/gluster/cli/peer.py +++ b/gluster/cli/peer.py @@ -9,8 +9,8 @@ # cases as published by the Free Software Foundation. # -from utils import peer_execute, peer_execute_xml, gluster_execute_xml -from parsers import parse_peer_status, parse_pool_list +from .utils import peer_execute, peer_execute_xml, gluster_execute_xml +from .parsers import parse_peer_status, parse_pool_list def probe(host): diff --git a/gluster/cli/quota.py b/gluster/cli/quota.py index d7cfa3e..94b40eb 100644 --- a/gluster/cli/quota.py +++ b/gluster/cli/quota.py @@ -9,8 +9,8 @@ # cases as published by the Free Software Foundation. # -from utils import quota_execute, quota_execute_xml, volume_execute -from parsers import parse_quota_list_paths, parse_quota_list_objects +from .utils import quota_execute, quota_execute_xml, volume_execute +from .parsers import parse_quota_list_paths, parse_quota_list_objects def inode_quota_enable(volname): diff --git a/gluster/cli/rebalance.py b/gluster/cli/rebalance.py index cc65b8b..e7294fa 100644 --- a/gluster/cli/rebalance.py +++ b/gluster/cli/rebalance.py @@ -9,8 +9,8 @@ # cases as published by the Free Software Foundation. # -from utils import volume_execute, volume_execute_xml -from parsers import parse_rebalance_status +from .utils import volume_execute, volume_execute_xml +from .parsers import parse_rebalance_status def fix_layout_start(volname): diff --git a/gluster/cli/snapshot.py b/gluster/cli/snapshot.py index 5522040..85d5f88 100644 --- a/gluster/cli/snapshot.py +++ b/gluster/cli/snapshot.py @@ -9,10 +9,10 @@ # cases as published by the Free Software Foundation. # -from utils import snapshot_execute, snapshot_execute_xml -from parsers import (parse_snapshot_status, - parse_snapshot_info, - parse_snapshot_list) +from .utils import snapshot_execute, snapshot_execute_xml +from .parsers import (parse_snapshot_status, + parse_snapshot_info, + parse_snapshot_list) def activate(snapname, force=False): diff --git a/gluster/cli/tier.py b/gluster/cli/tier.py index 983813d..2fa1624 100644 --- a/gluster/cli/tier.py +++ b/gluster/cli/tier.py @@ -9,8 +9,8 @@ # cases as published by the Free Software Foundation. # -from utils import tier_execute, tier_execute_xml -from parsers import parse_tier_detach, parse_tier_status +from .utils import tier_execute, tier_execute_xml +from .parsers import parse_tier_detach, parse_tier_status def status(volname): diff --git a/gluster/cli/volume.py b/gluster/cli/volume.py index c5f594e..4d7d4d0 100644 --- a/gluster/cli/volume.py +++ b/gluster/cli/volume.py @@ -9,22 +9,21 @@ # cases as published by the Free Software Foundation. # -from utils import volume_execute, volume_execute_xml, GlusterCmdException -from parsers import (parse_volume_info, - parse_volume_status, - parse_volume_options, - parse_volume_list, - parse_volume_profile_info) +from .utils import volume_execute, volume_execute_xml, GlusterCmdException +from .parsers import (parse_volume_info, + parse_volume_status, + parse_volume_options, + parse_volume_list, + parse_volume_profile_info) # Following import are not used in this file, but imported to make # it available via volume.(noqa to ignore in pep8 check) -import bitrot # noqa -import bricks # noqa -import georep # noqa -import heal # noqa -import quota # noqa -import rebalance # noqa -import tier # noqa +from . import bitrot # noqa +from . import bricks # noqa +from . import heal # noqa +from . import quota # noqa +from . import rebalance # noqa +from . import tier # noqa LOCK_KINDS = ["blocked", "granted", "all"] diff --git a/setup.py b/setup.py index abc7e67..1f5b623 100644 --- a/setup.py +++ b/setup.py @@ -52,6 +52,9 @@ def read(fname): 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', 'Topic :: System :: Filesystems', ], )