mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
flake8
This commit is contained in:
@@ -4,10 +4,8 @@
|
|||||||
# Python
|
# Python
|
||||||
import re
|
import re
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
import logging
|
from datetime import datetime
|
||||||
from datetime import datetime, timedelta
|
|
||||||
from optparse import make_option
|
from optparse import make_option
|
||||||
from dateutil.relativedelta import relativedelta
|
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
@@ -19,8 +17,6 @@ from awx.fact.models.fact import * # noqa
|
|||||||
OLDER_THAN = 'older_than'
|
OLDER_THAN = 'older_than'
|
||||||
GRANULARITY = 'granularity'
|
GRANULARITY = 'granularity'
|
||||||
|
|
||||||
logger = logging.getLogger('awx.main.commands.cleanup_facts')
|
|
||||||
|
|
||||||
class CleanupFacts(object):
|
class CleanupFacts(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.timestamp = None
|
self.timestamp = None
|
||||||
@@ -121,9 +117,9 @@ class Command(BaseCommand):
|
|||||||
older_than = self.string_time_to_timestamp(options[OLDER_THAN])
|
older_than = self.string_time_to_timestamp(options[OLDER_THAN])
|
||||||
granularity = self.string_time_to_timestamp(options[GRANULARITY])
|
granularity = self.string_time_to_timestamp(options[GRANULARITY])
|
||||||
|
|
||||||
if older_than == None:
|
if older_than is None:
|
||||||
raise CommandError('--older_than invalid value "%s"' % options[OLDER_THAN])
|
raise CommandError('--older_than invalid value "%s"' % options[OLDER_THAN])
|
||||||
if granularity == None:
|
if granularity is None:
|
||||||
raise CommandError('--granularity invalid value "%s"' % options[GRANULARITY])
|
raise CommandError('--granularity invalid value "%s"' % options[GRANULARITY])
|
||||||
|
|
||||||
cleanup_facts.run(older_than, granularity)
|
cleanup_facts.run(older_than, granularity)
|
||||||
|
|||||||
Reference in New Issue
Block a user