]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
provision/downburst: py3 fixes 1536/head
authorKyr Shatskyy <kyrylo.shatskyy@suse.com>
Wed, 15 Jul 2020 21:11:08 +0000 (23:11 +0200)
committerKyr Shatskyy <kyrylo.shatskyy@suse.com>
Wed, 15 Jul 2020 21:11:08 +0000 (23:11 +0200)
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
teuthology/provision/downburst.py

index d61fadfa3030906aefccdcf2f4c97322b0c2e112..30c6d3ce8be5f05e638d72ee09616c8043197a15 100644 (file)
@@ -118,7 +118,9 @@ class Downburst(object):
             distro=self.os_type,
             distroversion=self.os_version
         ))
-        proc = subprocess.Popen(args, stdout=subprocess.PIPE,
+        log.debug(args)
+        proc = subprocess.Popen(args, universal_newlines=True,
+                                stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
         out, err = proc.communicate()
         return (proc.returncode, out, err)
@@ -135,7 +137,9 @@ class Downburst(object):
         if self.logfile:
             args.extend(['-l', self.logfile])
         args.extend(['destroy', self.shortname])
-        proc = subprocess.Popen(args, stdout=subprocess.PIPE,
+        log.debug(args)
+        proc = subprocess.Popen(args, universal_newlines=True,
+                                stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE,)
         out, err = proc.communicate()
         log.info(out)
@@ -156,7 +160,7 @@ class Downburst(object):
         """
         Assemble a configuration to pass to downburst, and write it to a file.
         """
-        config_fd = tempfile.NamedTemporaryFile(delete=False)
+        config_fd = tempfile.NamedTemporaryFile(delete=False, mode='wt')
 
         os_type = self.os_type.lower()
         mac_address = self.status['mac_address']
@@ -208,7 +212,7 @@ class Downburst(object):
         # to install 'python' to get python2.7, which ansible needs
         if os_type in ('ubuntu', 'fedora'):
             user_info['packages'].append('python')
-        user_fd = tempfile.NamedTemporaryFile(delete=False)
+        user_fd = tempfile.NamedTemporaryFile(delete=False, mode='wt')
         user_str = "#cloud-config\n" + yaml.safe_dump(user_info)
         user_fd.write(user_str)
         self.user_path = user_fd.name