Пример #1
0
    def _backup_postgresql_psycopg2_db(self, db_conf, outfile, tmp_outfile):
        passwd = ('export PGPASSWORD=%s;' % db_conf['password']
                    if db_conf['password'] else '')
        outfile = '%s.pgsql.gz' % outfile
        ret = os.system('%s pg_dump %s > %s' %
                (passwd, build_postgres_args(db_conf), tmp_outfile.name))

        return ret, outfile
Пример #2
0
    def _backup_postgresql_psycopg2_db(self, db_conf, outfile):
        passwd = ('export PGPASSWORD=%s;' % db_conf['password']
                    if db_conf['password'] else '')
        outfile = '%s.pgsql.gz' % outfile
        _check_writable(outfile)
        ret = os.system('%s pg_dump %s | gzip -9 > %s' %
                (passwd, build_postgres_args(db_conf), outfile))

        return ret, outfile
Пример #3
0
    def _backup_postgresql_psycopg2_db(self, db_conf, outfile, tmp_outfile):
        passwd = ('export PGPASSWORD=%s;' %
                  db_conf['password'] if db_conf['password'] else '')
        outfile = '%s.pgsql.gz' % outfile
        ret = os.system(
            '%s pg_dump %s > %s' %
            (passwd, build_postgres_args(db_conf), tmp_outfile.name))

        return ret, outfile
Пример #4
0
 def _load_postgresql_psycopg2_db(self, db_conf, infile):
     passwd = "export PGPASSWORD=%s;" % db_conf["password"] if db_conf["password"] else ""
     return os.system("%s psql %s -f %s" % (passwd, build_postgres_args(db_conf), infile))