Fix ValueError if invalid max_rows passed to db purge

In current behaviour, if user passes max_rows as string
value then it gives following error:
ValueError: invalid literal for int() with base 10:
'string value'

This patch fixes this issue by adding 'int' type validation
for max_rows.

Change-Id: I95273352466bbe23b0fb9094342260dc5b5f7d67
This commit is contained in:
pooja jadhav 2017-07-14 18:32:46 +05:30
parent 1d3230a0e9
commit 9540780e27
1 changed files with 2 additions and 2 deletions

View File

@ -706,8 +706,8 @@ class DbCommands(object):
"""Print the current database version."""
print(migration.db_version())
@args('--max_rows', metavar='<number>', default=1000,
help='Maximum number of deleted rows to archive')
@args('--max_rows', type=int, metavar='<number>', default=1000,
help='Maximum number of deleted rows to archive')
@args('--verbose', action='store_true', dest='verbose', default=False,
help='Print how many rows were archived per table.')
@args('--until-complete', action='store_true', dest='until_complete',