def _mongodump_exec(mongodump, address, port, user, passwd, db,
                    out_dir, auth_db, dry_run):
    """
    Run mongodump on a database

    :param address: server host name or IP address
    :param port: server port
    :param user: user name
    :param passwd: password
    :param db: database name
    :param out_dir: output directory
    :param auth_db: authentication database
    :param dry_run: dry run mode
    :raises OSError: if mongodump process returns error
    """

    # Log the call
    log.msg("mongodump [{mongodump}] db={db} auth_db={auth_db}" \
            " mongodb://{user}@{host}:{port} > {output}"
            .format(mongodump=mongodump, user=user, host=address,
                    port=port, db=db, auth_db=auth_db, output=out_dir))

    # Prepare the call
    args = "--host {host}:{port} -d {db} -u {user} -p {passwd} " \
           "--authenticationDatabase {auth_db} -o {output}"\
           .format(host=address, port=port, db=db, user=user, passwd=passwd,
                   auth_db=auth_db, output=out_dir)

    if not dry_run:
        # Make the actual call to mongodump
        shell.run(mongodump, args=args)
Run mongodump on a database

    :param address: server host name or IP address
    :param port: server port
    :param user: user name
    :param passwd: password
    :param db: database name
    :param out_dir: output directory
    :param auth_db: authentication database
    :param dry_run: dry run mode
    :raises OSError: if mongodump process returns error