]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-volume: Try to cast OSD metadata to int while scanning directory
authorWido den Hollander <wido@42on.com>
Wed, 13 Dec 2017 10:20:53 +0000 (11:20 +0100)
committerWido den Hollander <wido@42on.com>
Wed, 13 Dec 2017 10:20:53 +0000 (11:20 +0100)
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 <wido@42on.com>
src/ceph-volume/ceph_volume/devices/simple/scan.py

index 905baf415889c06c0490d1fdd74c0f64f02416d0..b0eb9accc58a7c1f17b7fe9c0f6ec200282c9946 100644 (file)
@@ -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