]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-daemon: make StringIO usage py2 compatible
authorSage Weil <sage@redhat.com>
Wed, 30 Oct 2019 15:33:52 +0000 (10:33 -0500)
committerSage Weil <sage@redhat.com>
Wed, 30 Oct 2019 18:29:49 +0000 (13:29 -0500)
Otherwise,

Traceback (most recent call last):
  File "../src/ceph-daemon", line 1698, in <module>
    r = args.func()
  File "../src/ceph-daemon", line 767, in command_bootstrap
    with StringIO() as f:
AttributeError: StringIO instance has no attribute '__exit__'

Signed-off-by: Sage Weil <sage@redhat.com>
src/ceph-daemon

index 9ac185a474269321401b169401211d96c859f360..292969a8010318bbb0040889a66ab9dcb34ccf2f 100755 (executable)
@@ -764,9 +764,9 @@ def command_bootstrap():
         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()
+    cpf = StringIO()
+    cp.write(cpf)
+    config = cpf.getvalue()
 
     if not args.skip_ping_check:
         logger.info('Verifying we can ping mon IP %s...' % mon_ip)