]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/rbd: update NamedTemporaryFile usage for python3
authorIlya Dryomov <idryomov@gmail.com>
Tue, 28 Apr 2020 21:22:17 +0000 (23:22 +0200)
committerKefu Chai <kchai@redhat.com>
Wed, 3 Jun 2020 11:57:00 +0000 (19:57 +0800)
- open the file in text mode to avoid 'bytes' objects

- 'bufsize' is now spelled 'buffering' and switching buffering off
  with 'buffering=0' is only allowed in binary mode.  As we need the
  file to be either in the page cache or on disk before we copy it
  to the remote, call flush().

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit aba9910388cce7c03aa90726b5de1263298ac8ec)

qa/tasks/rbd.py

index 8e635e1cbb311aec4a6a80d4094e35656f5c9a38..84ad7ee7e7bb498350841f72d5766b55f4cb8db8 100644 (file)
@@ -413,9 +413,10 @@ def run_xfstests_one_client(ctx, role, properties):
         log.info('         randomize: {randomize}'.format(randomize=randomize))
 
         if exclude_list:
-            with tempfile.NamedTemporaryFile(bufsize=0, prefix='exclude') as exclude_file:
+            with tempfile.NamedTemporaryFile(mode='w', prefix='exclude') as exclude_file:
                 for test in exclude_list:
                     exclude_file.write("{}\n".format(test))
+                exclude_file.flush()
                 remote.put_file(exclude_file.name, exclude_file.name)
 
         # Note that the device paths are interpreted using