Skip to content

Commit aa26a5a

Browse files
committed
ceph-volume: add type annotations to devices.lvm.deactivate
This commit adds the Python type annotations to `devices.lvm.deactivate`. Signed-off-by: Guillaume Abrioux <[email protected]>
1 parent a9a149b commit aa26a5a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/ceph-volume/ceph_volume/devices/lvm/deactivate.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
from ceph_volume import conf
66
from ceph_volume.util import encryption, system
77
from ceph_volume.api.lvm import get_lvs_by_tag
8+
from typing import List, Optional
89

910
logger = logging.getLogger(__name__)
1011

1112

12-
def deactivate_osd(osd_id=None, osd_uuid=None):
13+
def deactivate_osd(osd_id: Optional[str] = None,
14+
osd_uuid: Optional[str] = None) -> None:
1315

1416
lvs = []
1517
if osd_uuid is not None:
@@ -35,7 +37,10 @@ class Deactivate(object):
3537

3638
help = 'Deactivate OSDs'
3739

38-
def deactivate(self, args=None):
40+
def __init__(self, argv: Optional[List[str]] = None) -> None:
41+
self.argv = argv
42+
43+
def deactivate(self, args: Optional[argparse.Namespace] = None) -> None:
3944
if args:
4045
self.args = args
4146
try:
@@ -45,10 +50,7 @@ def deactivate(self, args=None):
4550
'{}').format(self.args.osd_id))
4651
sys.exit(1)
4752

48-
def __init__(self, argv):
49-
self.argv = argv
50-
51-
def main(self):
53+
def main(self) -> None:
5254
sub_command_help = dedent("""
5355
Deactivate unmounts and OSDs tmpfs and closes any crypt devices.
5456
@@ -76,6 +78,8 @@ def main(self):
7678
# action='store_true',
7779
# help='Deactivate all OSD volumes found in the system',
7880
# )
81+
if self.argv is None:
82+
self.argv = []
7983
if len(self.argv) == 0:
8084
print(sub_command_help)
8185
return

0 commit comments

Comments
 (0)