mirror of
https://github.com/ansible/awx.git
synced 2026-05-24 09:07:45 -02:30
Merge pull request #11544 from AlanCoding/another_rule
Respect linter rule F811 about trivial re-definition
This commit is contained in:
@@ -541,8 +541,7 @@ class JobEvent(BasePlaybookEvent):
|
|||||||
return
|
return
|
||||||
job = self.job
|
job = self.job
|
||||||
|
|
||||||
from awx.main.models import Host, JobHostSummary # circular import
|
from awx.main.models import Host, JobHostSummary, HostMetric # circular import
|
||||||
from awx.main.models import Host, JobHostSummary, HostMetric
|
|
||||||
|
|
||||||
all_hosts = Host.objects.filter(pk__in=self.host_map.values()).only('id', 'name')
|
all_hosts = Host.objects.filter(pk__in=self.host_map.values()).only('id', 'name')
|
||||||
existing_host_ids = set(h.id for h in all_hosts)
|
existing_host_ids = set(h.id for h in all_hosts)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# Python
|
# Python
|
||||||
from asyncio.log import logger
|
|
||||||
from collections import deque, OrderedDict
|
from collections import deque, OrderedDict
|
||||||
from distutils.dir_util import copy_tree
|
from distutils.dir_util import copy_tree
|
||||||
import errno
|
import errno
|
||||||
@@ -39,7 +38,6 @@ from awx.main.constants import ACTIVE_STATES
|
|||||||
from awx.main.dispatch.publish import task
|
from awx.main.dispatch.publish import task
|
||||||
from awx.main.dispatch import get_local_queuename
|
from awx.main.dispatch import get_local_queuename
|
||||||
from awx.main.constants import PRIVILEGE_ESCALATION_METHODS, STANDARD_INVENTORY_UPDATE_ENV, MINIMAL_EVENTS, JOB_FOLDER_PREFIX
|
from awx.main.constants import PRIVILEGE_ESCALATION_METHODS, STANDARD_INVENTORY_UPDATE_ENV, MINIMAL_EVENTS, JOB_FOLDER_PREFIX
|
||||||
from awx.main.utils.safe_yaml import safe_dump
|
|
||||||
from awx.main.redact import UriCleaner
|
from awx.main.redact import UriCleaner
|
||||||
from awx.main.models import (
|
from awx.main.models import (
|
||||||
Instance,
|
Instance,
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
import stat
|
import stat
|
||||||
import subprocess
|
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import threading
|
import threading
|
||||||
import contextlib
|
import contextlib
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ from ansible.module_utils.six import raise_from
|
|||||||
from ansible.plugins.lookup import LookupBase
|
from ansible.plugins.lookup import LookupBase
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from dateutil import rrule
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pytz
|
import pytz
|
||||||
@@ -132,10 +131,7 @@ class LookupModule(LookupBase):
|
|||||||
# plugin constructor
|
# plugin constructor
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
if LIBRARY_IMPORT_ERROR:
|
if LIBRARY_IMPORT_ERROR:
|
||||||
raise_from(
|
raise_from(AnsibleError('{0}'.format(LIBRARY_IMPORT_ERROR)), LIBRARY_IMPORT_ERROR)
|
||||||
AnsibleError('{0}'.format(LIBRARY_IMPORT_ERROR)),
|
|
||||||
LIBRARY_IMPORT_ERROR
|
|
||||||
)
|
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ def source_cred_aim_alt(aim_cred_type):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_aim_credential_source(run_module, admin_user, organization, source_cred_aim, source_cred_aim_alt, silence_deprecation):
|
def test_aim_credential_source_change_source(run_module, admin_user, organization, source_cred_aim, source_cred_aim_alt, silence_deprecation):
|
||||||
ct = CredentialType.defaults['ssh']()
|
ct = CredentialType.defaults['ssh']()
|
||||||
ct.save()
|
ct.save()
|
||||||
tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'})
|
tgt_cred = Credential.objects.create(name='Test Machine Credential', organization=organization, credential_type=ct, inputs={'username': 'bob'})
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ def test_survey_spec_only_changed(run_module, admin_user, organization, survey_s
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_survey_spec_only_changed(run_module, admin_user, organization, survey_spec):
|
def test_survey_spec_missing_field(run_module, admin_user, organization, survey_spec):
|
||||||
wfjt = WorkflowJobTemplate.objects.create(organization=organization, name='foo-workflow', survey_enabled=True, survey_spec=survey_spec)
|
wfjt = WorkflowJobTemplate.objects.create(organization=organization, name='foo-workflow', survey_enabled=True, survey_spec=survey_spec)
|
||||||
result = run_module('workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'state': 'present'}, admin_user)
|
result = run_module('workflow_job_template', {'name': 'foo-workflow', 'organization': organization.name, 'state': 'present'}, admin_user)
|
||||||
assert not result.get('failed', False), result.get('msg', result)
|
assert not result.get('failed', False), result.get('msg', result)
|
||||||
|
|||||||
2
tox.ini
2
tox.ini
@@ -13,5 +13,5 @@ commands =
|
|||||||
yamllint -s .
|
yamllint -s .
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
select = F401,F402,F821,F823,F841
|
select = F401,F402,F821,F823,F841,F811
|
||||||
exclude = awx/ui/node_modules,awx/ui/node_modules,env,awx_collection_build
|
exclude = awx/ui/node_modules,awx/ui/node_modules,env,awx_collection_build
|
||||||
|
|||||||
Reference in New Issue
Block a user