From df5be2b8ea79e0a39dca168926b749014eea71fe Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Tue, 2 May 2017 22:03:36 +0530 Subject: [PATCH] Pep8 fixes for django_manage (#24198) Signed-off-by: Abhijeet Kasurde --- .../web_infrastructure/django_manage.py | 48 +++++++++++-------- test/sanity/pep8/legacy-files.txt | 1 - 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/lib/ansible/modules/web_infrastructure/django_manage.py b/lib/ansible/modules/web_infrastructure/django_manage.py index 806a9f9ede7..1ad96a7c39c 100644 --- a/lib/ansible/modules/web_infrastructure/django_manage.py +++ b/lib/ansible/modules/web_infrastructure/django_manage.py @@ -141,6 +141,7 @@ EXAMPLES = """ import os + def _fail(module, cmd, out, err, **kwargs): msg = '' if out: @@ -170,24 +171,31 @@ def _ensure_virtualenv(module): os.environ["PATH"] = "%s:%s" % (vbin, os.environ["PATH"]) os.environ["VIRTUAL_ENV"] = venv_param + def createcachetable_filter_output(line): return "Already exists" not in line + def flush_filter_output(line): return "Installed" in line and "Installed 0 object" not in line + def loaddata_filter_output(line): return "Installed" in line and "Installed 0 object" not in line + def syncdb_filter_output(line): return ("Creating table " in line) or ("Installed" in line and "Installed 0 object" not in line) + def migrate_filter_output(line): return ("Migrating forwards " in line) or ("Installed" in line and "Installed 0 object" not in line) or ("Applying" in line) + def collectstatic_filter_output(line): return line and "0 static files" not in line + def main(): command_allowed_param_map = dict( cleanup=(), @@ -199,11 +207,11 @@ def main(): validate=(), migrate=('apps', 'skip', 'merge', 'database',), collectstatic=('clear', 'link', ), - ) + ) command_required_param_map = dict( loaddata=('fixtures', ), - ) + ) # forces --noinput on every command that needs it noinput_commands = ( @@ -212,7 +220,7 @@ def main(): 'migrate', 'test', 'collectstatic', - ) + ) # These params are allowed for certain commands only specific_params = ('apps', 'clear', 'database', 'failfast', 'fixtures', 'liveserver', 'testrunner') @@ -224,23 +232,23 @@ def main(): module = AnsibleModule( argument_spec=dict( - command = dict(default=None, required=True), - app_path = dict(default=None, required=True), - settings = dict(default=None, required=False), - pythonpath = dict(default=None, required=False, aliases=['python_path']), - virtualenv = dict(default=None, required=False, aliases=['virtual_env']), - - apps = dict(default=None, required=False), - cache_table = dict(default=None, required=False), - clear = dict(default=None, required=False, type='bool'), - database = dict(default=None, required=False), - failfast = dict(default='no', required=False, type='bool', aliases=['fail_fast']), - fixtures = dict(default=None, required=False), - liveserver = dict(default=None, required=False, aliases=['live_server']), - testrunner = dict(default=None, required=False, aliases=['test_runner']), - skip = dict(default=None, required=False, type='bool'), - merge = dict(default=None, required=False, type='bool'), - link = dict(default=None, required=False, type='bool'), + command=dict(default=None, required=True), + app_path=dict(default=None, required=True), + settings=dict(default=None, required=False), + pythonpath=dict(default=None, required=False, aliases=['python_path']), + virtualenv=dict(default=None, required=False, aliases=['virtual_env']), + + apps=dict(default=None, required=False), + cache_table=dict(default=None, required=False), + clear=dict(default=None, required=False, type='bool'), + database=dict(default=None, required=False), + failfast=dict(default='no', required=False, type='bool', aliases=['fail_fast']), + fixtures=dict(default=None, required=False), + liveserver=dict(default=None, required=False, aliases=['live_server']), + testrunner=dict(default=None, required=False, aliases=['test_runner']), + skip=dict(default=None, required=False, type='bool'), + merge=dict(default=None, required=False, type='bool'), + link=dict(default=None, required=False, type='bool'), ), ) diff --git a/test/sanity/pep8/legacy-files.txt b/test/sanity/pep8/legacy-files.txt index 5f5af91fb17..ef254a57633 100644 --- a/test/sanity/pep8/legacy-files.txt +++ b/test/sanity/pep8/legacy-files.txt @@ -768,7 +768,6 @@ lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py lib/ansible/modules/web_infrastructure/deploy_helper.py -lib/ansible/modules/web_infrastructure/django_manage.py lib/ansible/modules/web_infrastructure/ejabberd_user.py lib/ansible/modules/web_infrastructure/htpasswd.py lib/ansible/modules/web_infrastructure/jboss.py