]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-daemon: make ConfigParser py2 compatible
authorSage Weil <sage@redhat.com>
Wed, 30 Oct 2019 15:32:00 +0000 (10:32 -0500)
committerSage Weil <sage@redhat.com>
Wed, 30 Oct 2019 18:29:49 +0000 (13:29 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/ceph-daemon

index 949af8ffb27e29f830d41897bdf5ca4cb951bc4e..9ac185a474269321401b169401211d96c859f360 100755 (executable)
@@ -241,8 +241,8 @@ def get_legacy_config_fsid(cluster):
     try:
         config = ConfigParser()
         config.read('/etc/ceph/%s.conf' % cluster)
-        if 'global' in config and 'fsid' in config['global']:
-            return config['global']['fsid']
+        if config.has_section('global') and config.has_option('global', 'fsid'):
+            return config.get('global', 'fsid')
     except Exception as e:
         logger.warning('unable to parse \'fsid\' from \'[global]\' section of /etc/ceph/ceph.conf: %s' % e)
         return None
@@ -760,8 +760,10 @@ def command_bootstrap():
         mon_ip = args.mon_addrv.split(':')[1]
     else:
         raise RuntimeError('must specify --mon-ip or --mon-addrv')
-    cp['global']['fsid'] = fsid;
-    cp['global']['mon host'] = addr_arg
+    if not cp.has_section('global'):
+        cp.add_section('global')
+    cp.set('global', 'fsid', fsid);
+    cp.set('global', 'mon host', addr_arg)
     with StringIO() as f:
         cp.write(f)
         config = f.getvalue()