mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 10:57:36 -02:30
Flake8 fixes.
This commit is contained in:
@@ -10,9 +10,8 @@ import time
|
|||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
from base64 import b64encode, b64decode
|
from base64 import b64encode
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from HTMLParser import HTMLParser
|
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import sys
|
|||||||
|
|
||||||
def argv_ready(argv):
|
def argv_ready(argv):
|
||||||
if argv and os.path.basename(argv[0]) in {'ansible', 'ansible-playbook'}:
|
if argv and os.path.basename(argv[0]) in {'ansible', 'ansible-playbook'}:
|
||||||
import tower_display_callback
|
import tower_display_callback # noqa
|
||||||
|
|
||||||
|
|
||||||
class argv_placeholder(object):
|
class argv_placeholder(object):
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
|
||||||
# Tower Display Callback
|
# Tower Display Callback
|
||||||
from . import cleanup # to register control persistent cleanup.
|
from . import cleanup # noqa (registers control persistent cleanup)
|
||||||
from . import display # to wrap ansible.display.Display methods.
|
from . import display # noqa (wraps ansible.display.Display methods)
|
||||||
from .module import TowerDefaultCallbackModule, TowerMinimalCallbackModule
|
from .module import TowerDefaultCallbackModule, TowerMinimalCallbackModule
|
||||||
|
|
||||||
__all__ = ['TowerDefaultCallbackModule', 'TowerMinimalCallbackModule']
|
__all__ = ['TowerDefaultCallbackModule', 'TowerMinimalCallbackModule']
|
||||||
|
|||||||
@@ -18,10 +18,7 @@
|
|||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
|
||||||
# Python
|
# Python
|
||||||
import cgi
|
|
||||||
import contextlib
|
|
||||||
import functools
|
import functools
|
||||||
import json
|
|
||||||
import sys
|
import sys
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@@ -36,6 +33,7 @@ __all__ = []
|
|||||||
|
|
||||||
def with_context(**context):
|
def with_context(**context):
|
||||||
global event_context
|
global event_context
|
||||||
|
|
||||||
def wrap(f):
|
def wrap(f):
|
||||||
@functools.wraps(f)
|
@functools.wraps(f)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
@@ -57,6 +55,7 @@ for attr in dir(Display):
|
|||||||
|
|
||||||
def with_verbosity(f):
|
def with_verbosity(f):
|
||||||
global event_context
|
global event_context
|
||||||
|
|
||||||
@functools.wraps(f)
|
@functools.wraps(f)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
host = args[2] if len(args) >= 3 else kwargs.get('host', None)
|
host = args[2] if len(args) >= 3 else kwargs.get('host', None)
|
||||||
@@ -72,6 +71,7 @@ Display.verbose = with_verbosity(Display.verbose)
|
|||||||
|
|
||||||
|
|
||||||
def display_with_context(f):
|
def display_with_context(f):
|
||||||
|
|
||||||
@functools.wraps(f)
|
@functools.wraps(f)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
log_only = args[5] if len(args) >= 6 else kwargs.get('log_only', False)
|
log_only = args[5] if len(args) >= 6 else kwargs.get('log_only', False)
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from __future__ import (absolute_import, division, print_function)
|
|||||||
|
|
||||||
# Python
|
# Python
|
||||||
import base64
|
import base64
|
||||||
import cgi
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ from __future__ import (absolute_import, division, print_function)
|
|||||||
# Python
|
# Python
|
||||||
import contextlib
|
import contextlib
|
||||||
import copy
|
import copy
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import uuid
|
import uuid
|
||||||
@@ -209,8 +208,10 @@ class BaseCallbackModule(CallbackBase):
|
|||||||
default=default,
|
default=default,
|
||||||
)
|
)
|
||||||
with self.capture_event_data('playbook_on_vars_prompt', **event_data):
|
with self.capture_event_data('playbook_on_vars_prompt', **event_data):
|
||||||
super(BaseCallbackModule, self).v2_playbook_on_vars_prompt(varname,
|
super(BaseCallbackModule, self).v2_playbook_on_vars_prompt(
|
||||||
private, prompt, encrypt, confirm, salt_size, salt, default)
|
varname, private, prompt, encrypt, confirm, salt_size, salt,
|
||||||
|
default,
|
||||||
|
)
|
||||||
|
|
||||||
def v2_playbook_on_include(self, included_file):
|
def v2_playbook_on_include(self, included_file):
|
||||||
event_data = dict(
|
event_data = dict(
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
# Python
|
# Python
|
||||||
import logging
|
import logging
|
||||||
import json
|
|
||||||
|
|
||||||
from kombu import Connection, Exchange, Queue
|
from kombu import Connection, Exchange, Queue
|
||||||
from kombu.mixins import ConsumerMixin
|
from kombu.mixins import ConsumerMixin
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ from urlparse import urljoin
|
|||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import cache
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.dateparse import parse_datetime
|
from django.utils.dateparse import parse_datetime
|
||||||
from django.utils.text import Truncator
|
from django.utils.text import Truncator
|
||||||
|
|||||||
@@ -991,9 +991,11 @@ class RunJob(BaseTask):
|
|||||||
Wrap stdout file object to capture events.
|
Wrap stdout file object to capture events.
|
||||||
'''
|
'''
|
||||||
stdout_handle = super(RunJob, self).get_stdout_handle(instance)
|
stdout_handle = super(RunJob, self).get_stdout_handle(instance)
|
||||||
|
|
||||||
def job_event_callback(event_data):
|
def job_event_callback(event_data):
|
||||||
event_data.setdefault('job_id', instance.id)
|
event_data.setdefault('job_id', instance.id)
|
||||||
JobEvent.create_from_data(**event_data)
|
JobEvent.create_from_data(**event_data)
|
||||||
|
|
||||||
return OutputEventFilter(stdout_handle, job_event_callback)
|
return OutputEventFilter(stdout_handle, job_event_callback)
|
||||||
|
|
||||||
def get_ssh_key_path(self, instance, **kwargs):
|
def get_ssh_key_path(self, instance, **kwargs):
|
||||||
@@ -1716,9 +1718,11 @@ class RunAdHocCommand(BaseTask):
|
|||||||
Wrap stdout file object to capture events.
|
Wrap stdout file object to capture events.
|
||||||
'''
|
'''
|
||||||
stdout_handle = super(RunAdHocCommand, self).get_stdout_handle(instance)
|
stdout_handle = super(RunAdHocCommand, self).get_stdout_handle(instance)
|
||||||
|
|
||||||
def ad_hoc_command_event_callback(event_data):
|
def ad_hoc_command_event_callback(event_data):
|
||||||
event_data.setdefault('ad_hoc_command_id', instance.id)
|
event_data.setdefault('ad_hoc_command_id', instance.id)
|
||||||
AdHocCommandEvent.create_from_data(**event_data)
|
AdHocCommandEvent.create_from_data(**event_data)
|
||||||
|
|
||||||
return OutputEventFilter(stdout_handle, ad_hoc_command_event_callback)
|
return OutputEventFilter(stdout_handle, ad_hoc_command_event_callback)
|
||||||
|
|
||||||
def get_ssh_key_path(self, instance, **kwargs):
|
def get_ssh_key_path(self, instance, **kwargs):
|
||||||
|
|||||||
@@ -27,4 +27,4 @@ if awx_lib_path not in sys.path:
|
|||||||
sys.path.insert(0, awx_lib_path)
|
sys.path.insert(0, awx_lib_path)
|
||||||
|
|
||||||
# Tower Display Callback
|
# Tower Display Callback
|
||||||
from tower_display_callback import TowerMinimalCallbackModule as CallbackModule
|
from tower_display_callback import TowerMinimalCallbackModule as CallbackModule # noqa
|
||||||
|
|||||||
@@ -27,4 +27,4 @@ if awx_lib_path not in sys.path:
|
|||||||
sys.path.insert(0, awx_lib_path)
|
sys.path.insert(0, awx_lib_path)
|
||||||
|
|
||||||
# Tower Display Callback
|
# Tower Display Callback
|
||||||
from tower_display_callback import TowerDefaultCallbackModule as CallbackModule
|
from tower_display_callback import TowerDefaultCallbackModule as CallbackModule # noqa
|
||||||
|
|||||||
Reference in New Issue
Block a user