Changeset e0295ed in rattail


Ignore:
Timestamp:
07/05/18 02:15:03 (2 years ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
f185169
Parents:
f2377be
Message:

Fix how verbosity is handled for db dump commands

i.e. don't include empty string as arg

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/commands/backup.py

    rf2377be re0295ed  
    290290            if not dry_run:
    291291                sql_path = os.path.join(outdir, '{}-mysql.sql'.format(name))
    292                 verbose = '--verbose' if False else '' # TODO
    293                 subprocess.check_call(['mysqldump', verbose, name, '--result-file={}'.format(sql_path)])
     292                mysqldump = ['mysqldump']
     293                if False: # TODO
     294                    mysqldump.append('--verbose')
     295                cmd = mysqldump + [name, '--result-file={}'.format(sql_path)]
     296                log.debug("mysqldump command is: %s", cmd)
     297                subprocess.check_call(cmd)
    294298                subprocess.check_call(['gzip', '--force', sql_path])
    295299                gz_path = "{}.gz".format(sql_path)
     
    305309                if os.path.exists(tmp_path):
    306310                    os.remove(tmp_path)
    307                 verbose = '--verbose' if False else '' # TODO
    308                 subprocess.check_call(['sudo', '-u', 'postgres', 'pg_dump', verbose, name, '--file={}'.format(tmp_path)])
     311                pg_dump = ['sudo', '-u', 'postgres', 'pg_dump', verbose]
     312                if False: # TODO
     313                    pg_dump.append('--verbose')
     314                cmd = pg_dump + [name, '--file={}'.format(tmp_path)]
     315                log.debug("pg_dump command is: %s", cmd)
     316                subprocess.check_call(cmd)
    309317                subprocess.check_call(['chown', 'root:', tmp_path])
    310318                subprocess.check_call(['mv', tmp_path, sql_path])
Note: See TracChangeset for help on using the changeset viewer.