|
9 | 9 | """ |
10 | 10 |
|
11 | 11 | import argparse |
| 12 | +import fnmatch |
12 | 13 | import json |
13 | 14 | import logging |
14 | 15 | import os |
|
23 | 24 | import zipfile |
24 | 25 | import tarfile |
25 | 26 | import urllib2 |
| 27 | + |
26 | 28 | import boto.dynamodb2.layer1 |
27 | 29 | from boto.dynamodb2.exceptions import ProvisionedThroughputExceededException |
28 | 30 | import botocore |
@@ -279,16 +281,8 @@ def get_table_name_matches(conn, table_name_wildcard, separator): |
279 | 281 |
|
280 | 282 | matching_tables = [] |
281 | 283 | for table_name in all_tables: |
282 | | - if table_name_wildcard == "*": |
283 | | - matching_tables.append(table_name) |
284 | | - elif separator is None: |
285 | | - if table_name.startswith(table_name_wildcard.split("*", 1)[0]): |
286 | | - matching_tables.append(table_name) |
287 | | - elif separator == "": |
288 | | - if table_name.startswith(re.sub(r"([A-Z])", r" \1", |
289 | | - table_name_wildcard.split("*", 1)[0]).split()[0]): |
290 | | - matching_tables.append(table_name) |
291 | | - elif table_name.split(separator, 1)[0] == table_name_wildcard.split("*", 1)[0]: |
| 284 | + if fnmatch.fnmatch(table_name, table_name_wildcard): |
| 285 | + logging.info("Adding %s", table_name) |
292 | 286 | matching_tables.append(table_name) |
293 | 287 |
|
294 | 288 | return matching_tables |
@@ -914,6 +908,8 @@ def main(): |
914 | 908 | try: |
915 | 909 | if args.srcTable.find("*") == -1: |
916 | 910 | do_backup(conn, args.read_capacity, tableQueue=None) |
| 911 | + else: |
| 912 | + do_backup(conn, args.read_capacity, matching_backup_tables) |
917 | 913 | except AttributeError: |
918 | 914 | # Didn't specify srcTable if we get here |
919 | 915 |
|
|
0 commit comments