Skip to content

Commit d10b7cc

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

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
from ceph_volume.exceptions import SuffixParsingError
55
from ceph_volume import decorators
66
from .activate import Activate
7+
from typing import List, Optional
78

89

9-
def parse_osd_id(string):
10+
def parse_osd_id(string: str) -> str:
1011
osd_id = string.split('-', 1)[0]
1112
if not osd_id:
1213
raise SuffixParsingError('OSD id', string)
@@ -15,7 +16,7 @@ def parse_osd_id(string):
1516
raise SuffixParsingError('OSD id', string)
1617

1718

18-
def parse_osd_uuid(string):
19+
def parse_osd_uuid(string: str) -> str:
1920
osd_id = '%s-' % parse_osd_id(string)
2021
# remove the id first
2122
osd_uuid = string.split(osd_id, 1)[-1]
@@ -28,11 +29,11 @@ class Trigger(object):
2829

2930
help = 'systemd helper to activate an OSD'
3031

31-
def __init__(self, argv):
32+
def __init__(self, argv: Optional[List[str]] = None) -> None:
3233
self.argv = argv
3334

3435
@decorators.needs_root
35-
def main(self):
36+
def main(self) -> None:
3637
sub_command_help = dedent("""
3738
** DO NOT USE DIRECTLY **
3839
This tool is meant to help the systemd unit that knows about OSDs.
@@ -61,6 +62,8 @@ def main(self):
6162
nargs='?',
6263
help='Data from a systemd unit containing ID and UUID of the OSD, like asdf-lkjh-0'
6364
)
65+
if self.argv is None:
66+
self.argv = []
6467
if len(self.argv) == 0:
6568
print(sub_command_help)
6669
return

0 commit comments

Comments
 (0)