From: Kiefer Chang Date: Wed, 23 Oct 2019 07:45:39 +0000 (+0800) Subject: python-common: fix lint errors X-Git-Tag: v15.1.0~1186^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=189a096b674b99b48cd167027f652f16c2545661;p=ceph-ci.git python-common: fix lint errors Signed-off-by: Kiefer Chang --- diff --git a/src/python-common/README.rst b/src/python-common/README.rst index 7bd424f7a7b..07f42fd147e 100644 --- a/src/python-common/README.rst +++ b/src/python-common/README.rst @@ -6,15 +6,15 @@ functions usable throughout the Ceph project. Like for example: -- All different Cython bindings -- MGR modules -- ``ceph`` command line interface and other Ceph tools. -- Also external tools +- All different Cython bindings. +- MGR modules. +- ``ceph`` command line interface and other Ceph tools. +- Also external tools. Requirements ============ -- ``python-six`` +- ``python-six`` Usage ===== diff --git a/src/python-common/ceph/deployment/drive_group.py b/src/python-common/ceph/deployment/drive_group.py index ff6719dea9f..0bc97644b22 100644 --- a/src/python-common/ceph/deployment/drive_group.py +++ b/src/python-common/ceph/deployment/drive_group.py @@ -3,7 +3,6 @@ try: from typing import Optional, List, Dict except ImportError: pass - import six @@ -45,7 +44,8 @@ class DeviceSelection(object): def validate(self): props = [self.id_model, self.size, self.rotates, self.count] if self.paths and any(p is not None for p in props): - raise DriveGroupValidationError('DeviceSelection: `paths` and other parameters are mutually exclusive') + raise DriveGroupValidationError( + 'DeviceSelection: `paths` and other parameters are mutually exclusive') if not any(p is not None for p in [self.paths] + props): raise DriveGroupValidationError('DeviceSelection cannot be empty') @@ -58,6 +58,7 @@ class DriveGroupValidationError(Exception): def __init__(self, msg): super(DriveGroupValidationError, self).__init__('Failed to validate Drive Group: ' + msg) + class DriveGroupSpec(object): """ Describe a drive group in the same form that ceph-volume @@ -147,4 +148,4 @@ class DriveGroupSpec(object): raise DriveGroupValidationError("objectstore not in ('filestore', 'bluestore')") if not self.hosts(all_hosts): raise DriveGroupValidationError( - "host_pattern '{}' does not match any hosts".format(self.host_pattern)) \ No newline at end of file + "host_pattern '{}' does not match any hosts".format(self.host_pattern)) diff --git a/src/python-common/ceph/deployment/ssh_orchestrator.py b/src/python-common/ceph/deployment/ssh_orchestrator.py index 2a81c527f5f..81c5fe9711d 100644 --- a/src/python-common/ceph/deployment/ssh_orchestrator.py +++ b/src/python-common/ceph/deployment/ssh_orchestrator.py @@ -1,10 +1,11 @@ - def bootstrap_cluster(): create_mon() create_mgr() + def create_mon(): pass + def create_mgr(): pass diff --git a/src/python-common/ceph/exceptions.py b/src/python-common/ceph/exceptions.py index 872bd8bbc7e..9fe50496a7b 100644 --- a/src/python-common/ceph/exceptions.py +++ b/src/python-common/ceph/exceptions.py @@ -10,13 +10,16 @@ class Error(Exception): return msg return '[errno {0}] {1}'.format(self.errno, msg) + class InvalidArgumentError(Error): pass + class OSError(Error): """ `OSError` class, derived from `Error` """ pass + class InterruptedOrTimeoutError(OSError): """ `InterruptedOrTimeoutError` class, derived from `OSError` """ pass @@ -84,4 +87,4 @@ class LogicError(Error): class TimedOut(OSError): """ `TimedOut` class, derived from `OSError` """ - pass \ No newline at end of file + pass diff --git a/src/python-common/ceph/tests/test_drive_group.py b/src/python-common/ceph/tests/test_drive_group.py index 71a3a16d874..ca215bc36cd 100644 --- a/src/python-common/ceph/tests/test_drive_group.py +++ b/src/python-common/ceph/tests/test_drive_group.py @@ -2,6 +2,7 @@ import pytest from ceph.deployment.drive_group import DriveGroupSpec, DeviceSelection, DriveGroupValidationError + def test_DriveGroup(): dg_json = { 'host_pattern': 'hostname',