From eeca05ec556244b662e814c3284b6c0d4f510305 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Fri, 2 Oct 2015 09:37:25 +0000 Subject: [PATCH] Fixes on deployment --- orchestra/management/commands/setuppostgres.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/orchestra/management/commands/setuppostgres.py b/orchestra/management/commands/setuppostgres.py index 6cca8264..ee4471ee 100644 --- a/orchestra/management/commands/setuppostgres.py +++ b/orchestra/management/commands/setuppostgres.py @@ -49,10 +49,7 @@ class Command(BaseCommand): def run_postgres(self, cmd, *args, **kwargs): cmd = cmd.replace("'", "\\'") - return run('su postgres -c "psql -c \\"%s\\""' % cmd, *args, **kwargs) - - def run_postgres2(self, cmd, *args, **kwargs): - return run('echo su postgres -c "psql -c \\"%s\\""' % cmd, *args, **kwargs) + return run('su postgres -c "psql -c \\"%s\\""' % cmd, *args, display=True, **kwargs) @check_root def handle(self, *args, **options): @@ -77,13 +74,13 @@ class Command(BaseCommand): msg = ("Postgres user '%(db_user)s' already exists, " "please provide a password [%(default_db_password)s]: " % context) context['db_password'] = input(msg) or context['default_db_password'] - self.run_postgres2(alter_user % context) + self.run_postgres(alter_user % context) elif options.get('db_password'): - self.run_postgres2(alter_user % context) + self.run_postgres(alter_user % context) else: raise CommandError("Postgres user '%(db_user)s' already exists and " "--db_pass has not been provided." % context) - self.run_postgres2(create_database % context) + self.run_postgres(create_database % context) # run(textwrap.dedent("""\ # su postgres -c "psql -c \\"CREATE USER %(db_user)s PASSWORD '%(db_password)s';\\"" || {