From: Alfredo Deza Date: Wed, 12 Jul 2017 21:31:54 +0000 (-0400) Subject: ceph-volume: systemd: ensure osd_id is digit-like X-Git-Tag: ses5-milestone10~3^2~5^2~45 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8928475fdcf24b672942d0f6b0c1b506c94df499;p=ceph.git ceph-volume: systemd: ensure osd_id is digit-like Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/systemd/main.py b/src/ceph-volume/ceph_volume/systemd/main.py index a904d97cd733..a82d62ea50fb 100644 --- a/src/ceph-volume/ceph_volume/systemd/main.py +++ b/src/ceph-volume/ceph_volume/systemd/main.py @@ -10,10 +10,6 @@ from ceph_volume import log, process from ceph_volume.exceptions import SuffixParsingError -log.setup(name='ceph-volume-systemd.log') -logger = logging.getLogger('systemd') - - def parse_subcommand(string): subcommand = string.rsplit('-', 1)[-1] if not subcommand: @@ -25,7 +21,9 @@ def parse_osd_id(string): osd_id = string.split('-', 1)[0] if not osd_id: raise SuffixParsingError('OSD id', string) - return osd_id + if osd_id.isdigit(): + return osd_id + raise SuffixParsingError('OSD id', string) def parse_osd_uuid(string): @@ -64,6 +62,9 @@ def main(args=None): ceph-volume lvm 0 8715BEB4-15C5-49DE-BA6F-401086EC7B41 """ + log.setup(name='ceph-volume-systemd.log') + logger = logging.getLogger('systemd') + args = args or sys.argv suffix = args[-1] sub_command = parse_subcommand(suffix)