From: Wido den Hollander Date: Wed, 13 Dec 2017 10:20:53 +0000 (+0100) Subject: ceph-volume: Try to cast OSD metadata to int while scanning directory X-Git-Tag: wip-pdonnell-testing-20180317.202121~823^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0333f74953e0aca7ab6f6dcf701466024470f88f;p=ceph-ci.git ceph-volume: Try to cast OSD metadata to int while scanning directory By doing so values like 'whoami' and 'bluefs' will be stored as a integer in the resulting JSON rather then a String. Signed-off-by: Wido den Hollander --- diff --git a/src/ceph-volume/ceph_volume/devices/simple/scan.py b/src/ceph-volume/ceph_volume/devices/simple/scan.py index 905baf41588..b0eb9accc58 100644 --- a/src/ceph-volume/ceph_volume/devices/simple/scan.py +++ b/src/ceph-volume/ceph_volume/devices/simple/scan.py @@ -74,7 +74,11 @@ class Scan(object): if system.is_binary(file_path): continue if os.path.isfile(file_path): - osd_metadata[_file] = self.get_contents(file_path) + content = self.get_contents(file_path) + try: + osd_metadata[_file] = int(content) + except ValueError: + osd_metadata[_file] = content device = path_mounts.get(path) # it is possible to have more than one device, pick the first one, and