Commit 92fdea86 authored by Jérome Perrin's avatar Jérome Perrin

recipe/postgres: python3 support

parent f78116fe
Pipeline #9105 failed with stage
...@@ -204,7 +204,7 @@ class Recipe(GenericBaseRecipe): ...@@ -204,7 +204,7 @@ class Recipe(GenericBaseRecipe):
password = self.options['password'] password = self.options['password']
# encrypt the password to avoid storing in the logs # encrypt the password to avoid storing in the logs
enc_password = 'md5' + hashlib.md5(password+user).hexdigest() enc_password = 'md5' + hashlib.md5((password + user).encode()).hexdigest()
self.runPostgresCommand(cmd="""ALTER USER "%s" ENCRYPTED PASSWORD '%s'""" % (user, enc_password)) self.runPostgresCommand(cmd="""ALTER USER "%s" ENCRYPTED PASSWORD '%s'""" % (user, enc_password))
...@@ -228,7 +228,7 @@ class Recipe(GenericBaseRecipe): ...@@ -228,7 +228,7 @@ class Recipe(GenericBaseRecipe):
'postgres', 'postgres',
], stdin=subprocess.PIPE) ], stdin=subprocess.PIPE)
p.communicate(cmd+'\n') p.communicate((cmd + '\n').encode())
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
raise UserError('Could not create database %s' % pgdata) raise UserError('Could not create database %s' % pgdata)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment