• Arnaud Fontaine's avatar
    mysql: With universal_newlines, python3 subprocess assumes that communicate()... · 9275552a
    Arnaud Fontaine authored
    mysql: With universal_newlines, python3 subprocess assumes that communicate() parameter is str() (not bytes()).
    
    But mysql_script_file was opened as a binary files and thus a bytes() was returned:
        File "etc/run/mariadb_update", line 51, in <module>
          sys.exit(slapos.recipe.generic_mysql.mysql.updateMysql(mysql_upgrade_binary='/srv/slapgrid/slappart3/bin/mysql_upgrade', mysql_binary='/srv/slapgrid/slappart3/bin/mysql', mysql_script_file='/srv/slapgrid/slappart3/etc/mariadb_initial_setup.sql'))
        File "parts/slapos.cookbook-repository/slapos/recipe/generic_mysql/mysql.py", line 31, in updateMysql
          result = mysql.communicate(mysql_script)[0]
        File "parts/python3/lib/python3.7/subprocess.py", line 964, in communicate
          stdout, stderr = self._communicate(input, endtime, timeout)
        File "parts/python3/lib/python3.7/subprocess.py", line 1692, in _communicate
          self._save_input(input)
        File "parts/python3/lib/python3.7/subprocess.py", line 1774, in _save_input
          self._input = self._input.encode(self.stdin.encoding,
      AttributeError: 'bytes' object has no attribute 'encode'
    9275552a
mysql.py 2.25 KB