diff --git a/awx/api/conf.py b/awx/api/conf.py index 12baf3f3bb..02fa88364f 100644 --- a/awx/api/conf.py +++ b/awx/api/conf.py @@ -7,7 +7,6 @@ from rest_framework import serializers # AWX from awx.conf import fields, register, register_validate - register( 'SESSION_COOKIE_AGE', field_class=fields.IntegerField, diff --git a/awx/api/fields.py b/awx/api/fields.py index 0a85d8f155..bf936cb7ba 100644 --- a/awx/api/fields.py +++ b/awx/api/fields.py @@ -21,7 +21,7 @@ class NullFieldMixin(object): """ def validate_empty_values(self, data): - (is_empty_value, data) = super(NullFieldMixin, self).validate_empty_values(data) + is_empty_value, data = super(NullFieldMixin, self).validate_empty_values(data) if is_empty_value and data is None: return (False, data) return (is_empty_value, data) diff --git a/awx/api/generics.py b/awx/api/generics.py index d1d168fc56..4efc54b9a1 100644 --- a/awx/api/generics.py +++ b/awx/api/generics.py @@ -764,7 +764,7 @@ class SubListCreateAttachDetachAPIView(SubListCreateAPIView): return Response(status=status.HTTP_204_NO_CONTENT) def unattach(self, request, *args, **kwargs): - (sub_id, res) = self.unattach_validate(request) + sub_id, res = self.unattach_validate(request) if res: return res return self.unattach_by_id(request, sub_id) diff --git a/awx/api/metrics.py b/awx/api/metrics.py index de66c2de33..49e15c240d 100644 --- a/awx/api/metrics.py +++ b/awx/api/metrics.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views import MetricsView - urls = [re_path(r'^$', MetricsView.as_view(), name='metrics_view')] __all__ = ['urls'] diff --git a/awx/api/urls/activity_stream.py b/awx/api/urls/activity_stream.py index 36b64a2de5..aade179914 100644 --- a/awx/api/urls/activity_stream.py +++ b/awx/api/urls/activity_stream.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views import ActivityStreamList, ActivityStreamDetail - urls = [ re_path(r'^$', ActivityStreamList.as_view(), name='activity_stream_list'), re_path(r'^(?P[0-9]+)/$', ActivityStreamDetail.as_view(), name='activity_stream_detail'), diff --git a/awx/api/urls/ad_hoc_command.py b/awx/api/urls/ad_hoc_command.py index 9c723e762b..59078346ae 100644 --- a/awx/api/urls/ad_hoc_command.py +++ b/awx/api/urls/ad_hoc_command.py @@ -14,7 +14,6 @@ from awx.api.views import ( AdHocCommandStdout, ) - urls = [ re_path(r'^$', AdHocCommandList.as_view(), name='ad_hoc_command_list'), re_path(r'^(?P[0-9]+)/$', AdHocCommandDetail.as_view(), name='ad_hoc_command_detail'), diff --git a/awx/api/urls/ad_hoc_command_event.py b/awx/api/urls/ad_hoc_command_event.py index cbfa72b8bc..c2dcc93d86 100644 --- a/awx/api/urls/ad_hoc_command_event.py +++ b/awx/api/urls/ad_hoc_command_event.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views import AdHocCommandEventDetail - urls = [ re_path(r'^(?P[0-9]+)/$', AdHocCommandEventDetail.as_view(), name='ad_hoc_command_event_detail'), ] diff --git a/awx/api/urls/analytics.py b/awx/api/urls/analytics.py index c8601c881d..2652e0bc38 100644 --- a/awx/api/urls/analytics.py +++ b/awx/api/urls/analytics.py @@ -5,7 +5,6 @@ from django.urls import re_path import awx.api.views.analytics as analytics - urls = [ re_path(r'^$', analytics.AnalyticsRootView.as_view(), name='analytics_root_view'), re_path(r'^authorized/$', analytics.AnalyticsAuthorizedView.as_view(), name='analytics_authorized'), diff --git a/awx/api/urls/credential.py b/awx/api/urls/credential.py index f2ae8535b9..c97399659d 100644 --- a/awx/api/urls/credential.py +++ b/awx/api/urls/credential.py @@ -16,7 +16,6 @@ from awx.api.views import ( CredentialExternalTest, ) - urls = [ re_path(r'^$', CredentialList.as_view(), name='credential_list'), re_path(r'^(?P[0-9]+)/activity_stream/$', CredentialActivityStreamList.as_view(), name='credential_activity_stream_list'), diff --git a/awx/api/urls/credential_input_source.py b/awx/api/urls/credential_input_source.py index 7ac4b3c4f4..5c78a7bb25 100644 --- a/awx/api/urls/credential_input_source.py +++ b/awx/api/urls/credential_input_source.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views import CredentialInputSourceDetail, CredentialInputSourceList - urls = [ re_path(r'^$', CredentialInputSourceList.as_view(), name='credential_input_source_list'), re_path(r'^(?P[0-9]+)/$', CredentialInputSourceDetail.as_view(), name='credential_input_source_detail'), diff --git a/awx/api/urls/credential_type.py b/awx/api/urls/credential_type.py index 8307126351..d12ce28b1e 100644 --- a/awx/api/urls/credential_type.py +++ b/awx/api/urls/credential_type.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views import CredentialTypeList, CredentialTypeDetail, CredentialTypeCredentialList, CredentialTypeActivityStreamList, CredentialTypeExternalTest - urls = [ re_path(r'^$', CredentialTypeList.as_view(), name='credential_type_list'), re_path(r'^(?P[0-9]+)/$', CredentialTypeDetail.as_view(), name='credential_type_detail'), diff --git a/awx/api/urls/execution_environments.py b/awx/api/urls/execution_environments.py index 2b4f325b1a..1352b08e83 100644 --- a/awx/api/urls/execution_environments.py +++ b/awx/api/urls/execution_environments.py @@ -8,7 +8,6 @@ from awx.api.views import ( ExecutionEnvironmentActivityStreamList, ) - urls = [ re_path(r'^$', ExecutionEnvironmentList.as_view(), name='execution_environment_list'), re_path(r'^(?P[0-9]+)/$', ExecutionEnvironmentDetail.as_view(), name='execution_environment_detail'), diff --git a/awx/api/urls/group.py b/awx/api/urls/group.py index 18107cd22a..a979827f50 100644 --- a/awx/api/urls/group.py +++ b/awx/api/urls/group.py @@ -18,7 +18,6 @@ from awx.api.views import ( GroupAdHocCommandsList, ) - urls = [ re_path(r'^$', GroupList.as_view(), name='group_list'), re_path(r'^(?P[0-9]+)/$', GroupDetail.as_view(), name='group_detail'), diff --git a/awx/api/urls/host.py b/awx/api/urls/host.py index 36bbb70da4..fcb208508f 100644 --- a/awx/api/urls/host.py +++ b/awx/api/urls/host.py @@ -18,7 +18,6 @@ from awx.api.views import ( HostAdHocCommandEventsList, ) - urls = [ re_path(r'^$', HostList.as_view(), name='host_list'), re_path(r'^(?P[0-9]+)/$', HostDetail.as_view(), name='host_detail'), diff --git a/awx/api/urls/instance.py b/awx/api/urls/instance.py index 84a3904657..e3d48ce190 100644 --- a/awx/api/urls/instance.py +++ b/awx/api/urls/instance.py @@ -14,7 +14,6 @@ from awx.api.views import ( ) from awx.api.views.instance_install_bundle import InstanceInstallBundle - urls = [ re_path(r'^$', InstanceList.as_view(), name='instance_list'), re_path(r'^(?P[0-9]+)/$', InstanceDetail.as_view(), name='instance_detail'), diff --git a/awx/api/urls/instance_group.py b/awx/api/urls/instance_group.py index a37d0840a8..e624f0abcc 100644 --- a/awx/api/urls/instance_group.py +++ b/awx/api/urls/instance_group.py @@ -12,7 +12,6 @@ from awx.api.views import ( InstanceGroupObjectRolesList, ) - urls = [ re_path(r'^$', InstanceGroupList.as_view(), name='instance_group_list'), re_path(r'^(?P[0-9]+)/$', InstanceGroupDetail.as_view(), name='instance_group_detail'), diff --git a/awx/api/urls/inventory.py b/awx/api/urls/inventory.py index b83b9b7208..c4caf78f6f 100644 --- a/awx/api/urls/inventory.py +++ b/awx/api/urls/inventory.py @@ -29,7 +29,6 @@ from awx.api.views import ( InventoryVariableData, ) - urls = [ re_path(r'^$', InventoryList.as_view(), name='inventory_list'), re_path(r'^(?P[0-9]+)/$', InventoryDetail.as_view(), name='inventory_detail'), diff --git a/awx/api/urls/inventory_source.py b/awx/api/urls/inventory_source.py index 120f5022c6..417add9a9d 100644 --- a/awx/api/urls/inventory_source.py +++ b/awx/api/urls/inventory_source.py @@ -18,7 +18,6 @@ from awx.api.views import ( InventorySourceNotificationTemplatesSuccessList, ) - urls = [ re_path(r'^$', InventorySourceList.as_view(), name='inventory_source_list'), re_path(r'^(?P[0-9]+)/$', InventorySourceDetail.as_view(), name='inventory_source_detail'), diff --git a/awx/api/urls/inventory_update.py b/awx/api/urls/inventory_update.py index 69b94e23c7..339212a53c 100644 --- a/awx/api/urls/inventory_update.py +++ b/awx/api/urls/inventory_update.py @@ -15,7 +15,6 @@ from awx.api.views import ( InventoryUpdateCredentialsList, ) - urls = [ re_path(r'^$', InventoryUpdateList.as_view(), name='inventory_update_list'), re_path(r'^(?P[0-9]+)/$', InventoryUpdateDetail.as_view(), name='inventory_update_detail'), diff --git a/awx/api/urls/job.py b/awx/api/urls/job.py index c629760081..41124e4689 100644 --- a/awx/api/urls/job.py +++ b/awx/api/urls/job.py @@ -19,7 +19,6 @@ from awx.api.views import ( JobHostSummaryDetail, ) - urls = [ re_path(r'^$', JobList.as_view(), name='job_list'), re_path(r'^(?P[0-9]+)/$', JobDetail.as_view(), name='job_detail'), diff --git a/awx/api/urls/job_host_summary.py b/awx/api/urls/job_host_summary.py index c736c59a17..202114224c 100644 --- a/awx/api/urls/job_host_summary.py +++ b/awx/api/urls/job_host_summary.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views import JobHostSummaryDetail - urls = [re_path(r'^(?P[0-9]+)/$', JobHostSummaryDetail.as_view(), name='job_host_summary_detail')] __all__ = ['urls'] diff --git a/awx/api/urls/job_template.py b/awx/api/urls/job_template.py index b73be7e913..e7d7f3cbde 100644 --- a/awx/api/urls/job_template.py +++ b/awx/api/urls/job_template.py @@ -23,7 +23,6 @@ from awx.api.views import ( JobTemplateCopy, ) - urls = [ re_path(r'^$', JobTemplateList.as_view(), name='job_template_list'), re_path(r'^(?P[0-9]+)/$', JobTemplateDetail.as_view(), name='job_template_detail'), diff --git a/awx/api/urls/label.py b/awx/api/urls/label.py index f7158275ae..81649446e2 100644 --- a/awx/api/urls/label.py +++ b/awx/api/urls/label.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views.labels import LabelList, LabelDetail - urls = [re_path(r'^$', LabelList.as_view(), name='label_list'), re_path(r'^(?P[0-9]+)/$', LabelDetail.as_view(), name='label_detail')] __all__ = ['urls'] diff --git a/awx/api/urls/notification.py b/awx/api/urls/notification.py index 2ed27e7c3d..ea67c41018 100644 --- a/awx/api/urls/notification.py +++ b/awx/api/urls/notification.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views import NotificationList, NotificationDetail - urls = [ re_path(r'^$', NotificationList.as_view(), name='notification_list'), re_path(r'^(?P[0-9]+)/$', NotificationDetail.as_view(), name='notification_detail'), diff --git a/awx/api/urls/notification_template.py b/awx/api/urls/notification_template.py index 764c571868..3bdb8fea96 100644 --- a/awx/api/urls/notification_template.py +++ b/awx/api/urls/notification_template.py @@ -11,7 +11,6 @@ from awx.api.views import ( NotificationTemplateCopy, ) - urls = [ re_path(r'^$', NotificationTemplateList.as_view(), name='notification_template_list'), re_path(r'^(?P[0-9]+)/$', NotificationTemplateDetail.as_view(), name='notification_template_detail'), diff --git a/awx/api/urls/organization.py b/awx/api/urls/organization.py index bbfe98af4a..90c47c252b 100644 --- a/awx/api/urls/organization.py +++ b/awx/api/urls/organization.py @@ -27,7 +27,6 @@ from awx.api.views.organization import ( ) from awx.api.views import OrganizationCredentialList - urls = [ re_path(r'^$', OrganizationList.as_view(), name='organization_list'), re_path(r'^(?P[0-9]+)/$', OrganizationDetail.as_view(), name='organization_detail'), diff --git a/awx/api/urls/project.py b/awx/api/urls/project.py index 0ce6cacecb..0166213177 100644 --- a/awx/api/urls/project.py +++ b/awx/api/urls/project.py @@ -22,7 +22,6 @@ from awx.api.views import ( ProjectCopy, ) - urls = [ re_path(r'^$', ProjectList.as_view(), name='project_list'), re_path(r'^(?P[0-9]+)/$', ProjectDetail.as_view(), name='project_detail'), diff --git a/awx/api/urls/project_update.py b/awx/api/urls/project_update.py index fc3e2d2d52..081f1c1b47 100644 --- a/awx/api/urls/project_update.py +++ b/awx/api/urls/project_update.py @@ -13,7 +13,6 @@ from awx.api.views import ( ProjectUpdateEventsList, ) - urls = [ re_path(r'^$', ProjectUpdateList.as_view(), name='project_update_list'), re_path(r'^(?P[0-9]+)/$', ProjectUpdateDetail.as_view(), name='project_update_detail'), diff --git a/awx/api/urls/receptor_address.py b/awx/api/urls/receptor_address.py index fe630f3da4..9d687a5ad7 100644 --- a/awx/api/urls/receptor_address.py +++ b/awx/api/urls/receptor_address.py @@ -8,7 +8,6 @@ from awx.api.views import ( ReceptorAddressDetail, ) - urls = [ re_path(r'^$', ReceptorAddressesList.as_view(), name='receptor_addresses_list'), re_path(r'^(?P[0-9]+)/$', ReceptorAddressDetail.as_view(), name='receptor_address_detail'), diff --git a/awx/api/urls/role.py b/awx/api/urls/role.py index 65479f1d68..fb716bd33d 100644 --- a/awx/api/urls/role.py +++ b/awx/api/urls/role.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views import RoleList, RoleDetail, RoleUsersList, RoleTeamsList - urls = [ re_path(r'^$', RoleList.as_view(), name='role_list'), re_path(r'^(?P[0-9]+)/$', RoleDetail.as_view(), name='role_detail'), diff --git a/awx/api/urls/schedule.py b/awx/api/urls/schedule.py index 40d839199b..e7e64db6c6 100644 --- a/awx/api/urls/schedule.py +++ b/awx/api/urls/schedule.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views import ScheduleList, ScheduleDetail, ScheduleUnifiedJobsList, ScheduleCredentialsList, ScheduleLabelsList, ScheduleInstanceGroupList - urls = [ re_path(r'^$', ScheduleList.as_view(), name='schedule_list'), re_path(r'^(?P[0-9]+)/$', ScheduleDetail.as_view(), name='schedule_detail'), diff --git a/awx/api/urls/system_job.py b/awx/api/urls/system_job.py index 891a697006..1cafc0786c 100644 --- a/awx/api/urls/system_job.py +++ b/awx/api/urls/system_job.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views import SystemJobList, SystemJobDetail, SystemJobCancel, SystemJobNotificationsList, SystemJobEventsList - urls = [ re_path(r'^$', SystemJobList.as_view(), name='system_job_list'), re_path(r'^(?P[0-9]+)/$', SystemJobDetail.as_view(), name='system_job_detail'), diff --git a/awx/api/urls/system_job_template.py b/awx/api/urls/system_job_template.py index e0b68d3135..7a80c10990 100644 --- a/awx/api/urls/system_job_template.py +++ b/awx/api/urls/system_job_template.py @@ -14,7 +14,6 @@ from awx.api.views import ( SystemJobTemplateNotificationTemplatesSuccessList, ) - urls = [ re_path(r'^$', SystemJobTemplateList.as_view(), name='system_job_template_list'), re_path(r'^(?P[0-9]+)/$', SystemJobTemplateDetail.as_view(), name='system_job_template_detail'), diff --git a/awx/api/urls/team.py b/awx/api/urls/team.py index 311a2e8009..5e370c5ee2 100644 --- a/awx/api/urls/team.py +++ b/awx/api/urls/team.py @@ -15,7 +15,6 @@ from awx.api.views import ( TeamAccessList, ) - urls = [ re_path(r'^$', TeamList.as_view(), name='team_list'), re_path(r'^(?P[0-9]+)/$', TeamDetail.as_view(), name='team_detail'), diff --git a/awx/api/urls/webhooks.py b/awx/api/urls/webhooks.py index bbbf1ebd2d..2e40695c18 100644 --- a/awx/api/urls/webhooks.py +++ b/awx/api/urls/webhooks.py @@ -2,7 +2,6 @@ from django.urls import re_path from awx.api.views.webhooks import WebhookKeyView, GithubWebhookReceiver, GitlabWebhookReceiver, BitbucketDcWebhookReceiver - urlpatterns = [ re_path(r'^webhook_key/$', WebhookKeyView.as_view(), name='webhook_key'), re_path(r'^github/$', GithubWebhookReceiver.as_view(), name='webhook_receiver_github'), diff --git a/awx/api/urls/workflow_approval.py b/awx/api/urls/workflow_approval.py index 640528edbd..81437c95ca 100644 --- a/awx/api/urls/workflow_approval.py +++ b/awx/api/urls/workflow_approval.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views import WorkflowApprovalList, WorkflowApprovalDetail, WorkflowApprovalApprove, WorkflowApprovalDeny - urls = [ re_path(r'^$', WorkflowApprovalList.as_view(), name='workflow_approval_list'), re_path(r'^(?P[0-9]+)/$', WorkflowApprovalDetail.as_view(), name='workflow_approval_detail'), diff --git a/awx/api/urls/workflow_approval_template.py b/awx/api/urls/workflow_approval_template.py index 811ad351d2..f87b437806 100644 --- a/awx/api/urls/workflow_approval_template.py +++ b/awx/api/urls/workflow_approval_template.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.api.views import WorkflowApprovalTemplateDetail, WorkflowApprovalTemplateJobsList - urls = [ re_path(r'^(?P[0-9]+)/$', WorkflowApprovalTemplateDetail.as_view(), name='workflow_approval_template_detail'), re_path(r'^(?P[0-9]+)/approvals/$', WorkflowApprovalTemplateJobsList.as_view(), name='workflow_approval_template_jobs_list'), diff --git a/awx/api/urls/workflow_job.py b/awx/api/urls/workflow_job.py index 707b7080f9..0285ca94e1 100644 --- a/awx/api/urls/workflow_job.py +++ b/awx/api/urls/workflow_job.py @@ -14,7 +14,6 @@ from awx.api.views import ( WorkflowJobActivityStreamList, ) - urls = [ re_path(r'^$', WorkflowJobList.as_view(), name='workflow_job_list'), re_path(r'^(?P[0-9]+)/$', WorkflowJobDetail.as_view(), name='workflow_job_detail'), diff --git a/awx/api/urls/workflow_job_node.py b/awx/api/urls/workflow_job_node.py index da029b34c2..433db8759d 100644 --- a/awx/api/urls/workflow_job_node.py +++ b/awx/api/urls/workflow_job_node.py @@ -14,7 +14,6 @@ from awx.api.views import ( WorkflowJobNodeInstanceGroupsList, ) - urls = [ re_path(r'^$', WorkflowJobNodeList.as_view(), name='workflow_job_node_list'), re_path(r'^(?P[0-9]+)/$', WorkflowJobNodeDetail.as_view(), name='workflow_job_node_detail'), diff --git a/awx/api/urls/workflow_job_template.py b/awx/api/urls/workflow_job_template.py index e2729186ca..87bd797bc9 100644 --- a/awx/api/urls/workflow_job_template.py +++ b/awx/api/urls/workflow_job_template.py @@ -22,7 +22,6 @@ from awx.api.views import ( WorkflowJobTemplateLabelList, ) - urls = [ re_path(r'^$', WorkflowJobTemplateList.as_view(), name='workflow_job_template_list'), re_path(r'^(?P[0-9]+)/$', WorkflowJobTemplateDetail.as_view(), name='workflow_job_template_detail'), diff --git a/awx/api/urls/workflow_job_template_node.py b/awx/api/urls/workflow_job_template_node.py index d4d992a043..f3d5200986 100644 --- a/awx/api/urls/workflow_job_template_node.py +++ b/awx/api/urls/workflow_job_template_node.py @@ -15,7 +15,6 @@ from awx.api.views import ( WorkflowJobTemplateNodeInstanceGroupsList, ) - urls = [ re_path(r'^$', WorkflowJobTemplateNodeList.as_view(), name='workflow_job_template_node_list'), re_path(r'^(?P[0-9]+)/$', WorkflowJobTemplateNodeDetail.as_view(), name='workflow_job_template_node_detail'), diff --git a/awx/api/views/inventory.py b/awx/api/views/inventory.py index b48cc87519..e518c74963 100644 --- a/awx/api/views/inventory.py +++ b/awx/api/views/inventory.py @@ -45,7 +45,6 @@ from awx.api.views.mixin import RelatedJobsPreventDeleteMixin from awx.api.pagination import UnifiedJobEventPagination - logger = logging.getLogger('awx.api.views.organization') diff --git a/awx/api/views/labels.py b/awx/api/views/labels.py index 3bc46d5203..c4b1b78fcb 100644 --- a/awx/api/views/labels.py +++ b/awx/api/views/labels.py @@ -28,7 +28,7 @@ class LabelSubListCreateAttachDetachView(SubListCreateAttachDetachAPIView): resource_purpose = 'labels of a resource' def unattach(self, request, *args, **kwargs): - (sub_id, res) = super().unattach_validate(request) + sub_id, res = super().unattach_validate(request) if res: return res diff --git a/awx/api/views/metrics.py b/awx/api/views/metrics.py index 2cda92cdd8..da0d73761f 100644 --- a/awx/api/views/metrics.py +++ b/awx/api/views/metrics.py @@ -14,7 +14,6 @@ from rest_framework.permissions import AllowAny from rest_framework.response import Response from rest_framework.exceptions import PermissionDenied - # AWX # from awx.main.analytics import collectors import awx.main.analytics.subsystem_metrics as s_metrics @@ -23,7 +22,6 @@ from awx.api import renderers from awx.api.generics import APIView - logger = logging.getLogger('awx.analytics') diff --git a/awx/conf/urls.py b/awx/conf/urls.py index 69d47b6afc..8165b59820 100644 --- a/awx/conf/urls.py +++ b/awx/conf/urls.py @@ -5,7 +5,6 @@ from django.urls import re_path from awx.conf.views import SettingCategoryList, SettingSingletonDetail, SettingLoggingTest - urlpatterns = [ re_path(r'^$', SettingCategoryList.as_view(), name='setting_category_list'), re_path(r'^(?P[a-z0-9-]+)/$', SettingSingletonDetail.as_view(), name='setting_singleton_detail'), diff --git a/awx/conf/views.py b/awx/conf/views.py index f12075148b..6b4345a1b1 100644 --- a/awx/conf/views.py +++ b/awx/conf/views.py @@ -32,7 +32,6 @@ from awx.conf.serializers import SettingCategorySerializer, SettingSingletonSeri from awx.conf import settings_registry from awx.main.utils.external_logging import reconfigure_rsyslog - SettingCategory = collections.namedtuple('SettingCategory', ('url', 'slug', 'name')) diff --git a/awx/main/analytics/broadcast_websocket.py b/awx/main/analytics/broadcast_websocket.py index a2ef9c8bd8..9bc092d9e4 100644 --- a/awx/main/analytics/broadcast_websocket.py +++ b/awx/main/analytics/broadcast_websocket.py @@ -15,7 +15,6 @@ from prometheus_client import ( from django.conf import settings from awx.main.utils.redis import get_redis_client, get_redis_client_async - BROADCAST_WEBSOCKET_REDIS_KEY_NAME = 'broadcast_websocket_stats' diff --git a/awx/main/analytics/collectors.py b/awx/main/analytics/collectors.py index d6ad30ef95..8e5c1f9cf0 100644 --- a/awx/main/analytics/collectors.py +++ b/awx/main/analytics/collectors.py @@ -487,9 +487,7 @@ def unified_jobs_table(since, full_path, until, **kwargs): OR (main_unifiedjob.finished > '{0}' AND main_unifiedjob.finished <= '{1}')) AND main_unifiedjob.launch_type != 'sync' ORDER BY main_unifiedjob.id ASC) TO STDOUT WITH CSV HEADER - '''.format( - since.isoformat(), until.isoformat() - ) + '''.format(since.isoformat(), until.isoformat()) return _copy_table(table='unified_jobs', query=unified_job_query, path=full_path) @@ -550,9 +548,7 @@ def workflow_job_node_table(since, full_path, until, **kwargs): ) always_nodes ON main_workflowjobnode.id = always_nodes.from_workflowjobnode_id WHERE (main_workflowjobnode.modified > '{}' AND main_workflowjobnode.modified <= '{}') ORDER BY main_workflowjobnode.id ASC) TO STDOUT WITH CSV HEADER - '''.format( - since.isoformat(), until.isoformat() - ) + '''.format(since.isoformat(), until.isoformat()) return _copy_table(table='workflow_job_node', query=workflow_job_node_query, path=full_path) diff --git a/awx/main/consumers.py b/awx/main/consumers.py index e78c054616..af9d7f1bbe 100644 --- a/awx/main/consumers.py +++ b/awx/main/consumers.py @@ -41,10 +41,10 @@ class WebsocketSecretAuthHelper: @classmethod def verify_secret(cls, s, nonce_tolerance=300): try: - (prefix, payload) = s.split(' ') + prefix, payload = s.split(' ') if prefix != 'HMAC-SHA256': raise ValueError('Unsupported encryption algorithm') - (nonce_parsed, secret_parsed) = payload.split(':') + nonce_parsed, secret_parsed = payload.split(':') except Exception: raise ValueError("Failed to parse secret") @@ -106,7 +106,7 @@ class RelayConsumer(AsyncJsonWebsocketConsumer): await self.send(event['text']) async def receive_json(self, data): - (group, message) = unwrap_broadcast_msg(data) + group, message = unwrap_broadcast_msg(data) if group == "metrics": message = json.loads(message['text']) await self._redis_conn.set( diff --git a/awx/main/dispatch/hazmat.py b/awx/main/dispatch/hazmat.py index a6bd2a8f38..b1b30db090 100644 --- a/awx/main/dispatch/hazmat.py +++ b/awx/main/dispatch/hazmat.py @@ -10,7 +10,6 @@ from awx import prepare_env from dispatcherd.utils import resolve_callable - prepare_env() django.setup() # noqa @@ -18,7 +17,6 @@ django.setup() # noqa from django.conf import settings - # Preload all periodic tasks so their imports will be in shared memory for name, options in settings.CELERYBEAT_SCHEDULE.items(): resolve_callable(options['task']) @@ -31,6 +29,5 @@ from awx.main.scheduler.kubernetes import PodManager # noqa from django.core.cache import cache as django_cache from django.db import connection - connection.close() django_cache.close() diff --git a/awx/main/dispatch/periodic.py b/awx/main/dispatch/periodic.py index d582823681..0d3229cd91 100644 --- a/awx/main/dispatch/periodic.py +++ b/awx/main/dispatch/periodic.py @@ -3,7 +3,6 @@ import time import yaml from datetime import datetime - logger = logging.getLogger('awx.main.dispatch.periodic') diff --git a/awx/main/fields.py b/awx/main/fields.py index a777d62c3d..9b8ab22ba3 100644 --- a/awx/main/fields.py +++ b/awx/main/fields.py @@ -40,7 +40,6 @@ from awx.main.validators import validate_ssh_private_key from awx.main.constants import ENV_BLOCKLIST from awx.main import utils - __all__ = [ 'JSONBlob', 'AutoOneToOneField', diff --git a/awx/main/management/commands/bottleneck.py b/awx/main/management/commands/bottleneck.py index b43e19a20a..6e914a5b61 100644 --- a/awx/main/management/commands/bottleneck.py +++ b/awx/main/management/commands/bottleneck.py @@ -23,8 +23,7 @@ class Command(BaseCommand): print('## ' + JobTemplate.objects.get(pk=jt).name + f' (last {history} runs)\n') with connection.cursor() as cursor: - cursor.execute( - f''' + cursor.execute(f''' SELECT b.id, b.job_id, b.host_name, b.created - a.created delta, b.task task, @@ -44,8 +43,7 @@ class Command(BaseCommand): LIMIT {history} ) ORDER BY delta DESC; - ''' - ) + ''') slowest_events = cursor.fetchall() def format_td(x): diff --git a/awx/main/management/commands/cleanup_activitystream.py b/awx/main/management/commands/cleanup_activitystream.py index 99042ffb22..c3cbf1a6e2 100644 --- a/awx/main/management/commands/cleanup_activitystream.py +++ b/awx/main/management/commands/cleanup_activitystream.py @@ -5,7 +5,6 @@ import datetime import logging - # Django from django.core.management.base import BaseCommand from django.utils.timezone import now diff --git a/awx/main/management/commands/cleanup_jobs.py b/awx/main/management/commands/cleanup_jobs.py index 4c47eadf0a..3b23cf7dee 100644 --- a/awx/main/management/commands/cleanup_jobs.py +++ b/awx/main/management/commands/cleanup_jobs.py @@ -6,7 +6,6 @@ import datetime import logging import re - # Django from django.apps import apps from django.core.management.base import BaseCommand, CommandError diff --git a/awx/main/management/commands/provision_instance.py b/awx/main/management/commands/provision_instance.py index 5a60328d96..1ee9cf58d1 100644 --- a/awx/main/management/commands/provision_instance.py +++ b/awx/main/management/commands/provision_instance.py @@ -35,7 +35,7 @@ class Command(BaseCommand): from awx.main.management.commands.register_queue import RegisterQueue - (changed, instance) = Instance.objects.register(ip_address=os.environ.get('MY_POD_IP'), node_type='control', node_uuid=settings.SYSTEM_UUID) + changed, instance = Instance.objects.register(ip_address=os.environ.get('MY_POD_IP'), node_type='control', node_uuid=settings.SYSTEM_UUID) RegisterQueue(settings.DEFAULT_CONTROL_PLANE_QUEUE_NAME, 100, 0, [], is_container_group=False).register() RegisterQueue( settings.DEFAULT_EXECUTION_QUEUE_NAME, @@ -48,7 +48,7 @@ class Command(BaseCommand): max_concurrent_jobs=settings.DEFAULT_EXECUTION_QUEUE_MAX_CONCURRENT_JOBS, ).register() else: - (changed, instance) = Instance.objects.register(hostname=hostname, node_type=node_type, node_uuid=uuid) + changed, instance = Instance.objects.register(hostname=hostname, node_type=node_type, node_uuid=uuid) if changed: print("Successfully registered instance {}".format(hostname)) else: diff --git a/awx/main/management/commands/register_queue.py b/awx/main/management/commands/register_queue.py index 9b8af6e031..e6dfd18a8b 100644 --- a/awx/main/management/commands/register_queue.py +++ b/awx/main/management/commands/register_queue.py @@ -34,7 +34,7 @@ class RegisterQueue: def get_create_update_instance_group(self): created = False changed = False - (ig, created) = InstanceGroup.objects.get_or_create(name=self.queuename) + ig, created = InstanceGroup.objects.get_or_create(name=self.queuename) if ig.policy_instance_percentage != self.instance_percent: ig.policy_instance_percentage = self.instance_percent changed = True @@ -91,14 +91,14 @@ class RegisterQueue: with advisory_lock('cluster_policy_lock'): with transaction.atomic(): changed2 = False - (ig, created, changed1) = self.get_create_update_instance_group() + ig, created, changed1 = self.get_create_update_instance_group() if created: print("Creating instance group {}".format(ig.name)) elif not created: print("Instance Group already registered {}".format(ig.name)) try: - (instances, changed2) = self.add_instances_to_group(ig) + instances, changed2 = self.add_instances_to_group(ig) for i in instances: print("Added instance {} to {}".format(i.hostname, ig.name)) except InstanceNotFound as e: diff --git a/awx/main/management/commands/run_wsrelay.py b/awx/main/management/commands/run_wsrelay.py index a3016ffc92..b6baa04985 100644 --- a/awx/main/management/commands/run_wsrelay.py +++ b/awx/main/management/commands/run_wsrelay.py @@ -19,7 +19,6 @@ from awx.main.analytics.broadcast_websocket import ( from awx.main.analytics.subsystem_metrics import WebsocketsMetricsServer from awx.main.wsrelay import WebSocketRelayManager - logger = logging.getLogger('awx.main.wsrelay') diff --git a/awx/main/middleware.py b/awx/main/middleware.py index 1d05ddbcdc..60cab7af9e 100644 --- a/awx/main/middleware.py +++ b/awx/main/middleware.py @@ -22,7 +22,6 @@ from awx.main.utils.common import memoize from awx.urls import get_urlpatterns from awx.main.utils.named_url_graph import reset_counters - logger = logging.getLogger('awx.main.middleware') perf_logger = logging.getLogger('awx.analytics.performance') diff --git a/awx/main/migrations/0070_v350_gce_instance_id.py b/awx/main/migrations/0070_v350_gce_instance_id.py index 4a7933e5d4..29896afcd3 100644 --- a/awx/main/migrations/0070_v350_gce_instance_id.py +++ b/awx/main/migrations/0070_v350_gce_instance_id.py @@ -8,7 +8,6 @@ from django.db import migrations from awx.main.migrations._inventory_source import set_new_instance_id, back_out_new_instance_id - logger = logging.getLogger('awx.main.migrations') diff --git a/awx/main/migrations/0112_v370_workflow_node_identifier.py b/awx/main/migrations/0112_v370_workflow_node_identifier.py index 95775798e5..6eab3c9c2e 100644 --- a/awx/main/migrations/0112_v370_workflow_node_identifier.py +++ b/awx/main/migrations/0112_v370_workflow_node_identifier.py @@ -4,7 +4,6 @@ from django.db import migrations, models import uuid import logging - logger = logging.getLogger('awx.main.migrations') diff --git a/awx/main/migrations/0119_inventory_plugins.py b/awx/main/migrations/0119_inventory_plugins.py index d9e490bda1..07df72ae15 100644 --- a/awx/main/migrations/0119_inventory_plugins.py +++ b/awx/main/migrations/0119_inventory_plugins.py @@ -9,7 +9,6 @@ from awx.main.models.base import VarsDictProperty from ._inventory_source_vars import FrozenInjectors - logger = logging.getLogger('awx.main.migrations') diff --git a/awx/main/migrations/0150_rename_inv_sources_inv_updates.py b/awx/main/migrations/0150_rename_inv_sources_inv_updates.py index 596d1f81f2..f076f017dc 100644 --- a/awx/main/migrations/0150_rename_inv_sources_inv_updates.py +++ b/awx/main/migrations/0150_rename_inv_sources_inv_updates.py @@ -5,7 +5,6 @@ from django.db import migrations, models from awx.main.models.credential import ManagedCredentialType, CredentialType as ModernCredentialType - logger = logging.getLogger(__name__) diff --git a/awx/main/migrations/0200_template_name_constraint.py b/awx/main/migrations/0200_template_name_constraint.py index 08239cad48..1b01dc57a7 100644 --- a/awx/main/migrations/0200_template_name_constraint.py +++ b/awx/main/migrations/0200_template_name_constraint.py @@ -6,7 +6,6 @@ from django.db import migrations, models from awx.main.migrations._db_constraints import _rename_duplicates - logger = logging.getLogger(__name__) diff --git a/awx/main/migrations/_OrgAdmin_to_use_ig.py b/awx/main/migrations/_OrgAdmin_to_use_ig.py index 5af468b9ef..b0c41cdd4a 100644 --- a/awx/main/migrations/_OrgAdmin_to_use_ig.py +++ b/awx/main/migrations/_OrgAdmin_to_use_ig.py @@ -1,6 +1,5 @@ import logging - logger = logging.getLogger('awx.main.migrations') diff --git a/awx/main/migrations/_dab_rbac.py b/awx/main/migrations/_dab_rbac.py index 58d8761166..d578d5e57c 100644 --- a/awx/main/migrations/_dab_rbac.py +++ b/awx/main/migrations/_dab_rbac.py @@ -13,7 +13,6 @@ from awx.main.constants import role_name_to_perm_mapping from ansible_base.rbac.permission_registry import permission_registry - logger = logging.getLogger('awx.main.migrations._dab_rbac') diff --git a/awx/main/migrations/_db_constraints.py b/awx/main/migrations/_db_constraints.py index 206953379e..189108c025 100644 --- a/awx/main/migrations/_db_constraints.py +++ b/awx/main/migrations/_db_constraints.py @@ -2,7 +2,6 @@ import logging from django.db.models import Count - logger = logging.getLogger(__name__) diff --git a/awx/main/migrations/_inventory_source_vars.py b/awx/main/migrations/_inventory_source_vars.py index 779655d73a..8ebdf4d895 100644 --- a/awx/main/migrations/_inventory_source_vars.py +++ b/awx/main/migrations/_inventory_source_vars.py @@ -5,7 +5,6 @@ import logging from django.utils.translation import gettext_lazy as _ from django.utils.encoding import iri_to_uri - FrozenInjectors = dict() logger = logging.getLogger('awx.main.migrations') diff --git a/awx/main/migrations/_multi_cred.py b/awx/main/migrations/_multi_cred.py index 1b2a99c110..afb976afa3 100644 --- a/awx/main/migrations/_multi_cred.py +++ b/awx/main/migrations/_multi_cred.py @@ -1,6 +1,5 @@ import logging - logger = logging.getLogger('awx.main.migrations') diff --git a/awx/main/migrations/_scan_jobs.py b/awx/main/migrations/_scan_jobs.py index 994297bbcb..27670379e6 100644 --- a/awx/main/migrations/_scan_jobs.py +++ b/awx/main/migrations/_scan_jobs.py @@ -1,6 +1,5 @@ import logging - logger = logging.getLogger('awx.main.migrations') diff --git a/awx/main/models/__init__.py b/awx/main/models/__init__.py index e4b4b3100c..8a71fb79c3 100644 --- a/awx/main/models/__init__.py +++ b/awx/main/models/__init__.py @@ -95,12 +95,10 @@ from awx.main.models.workflow import ( # noqa WorkflowApprovalTemplate, ) - # Add custom methods to User model for permissions checks. from django.contrib.auth.models import User # noqa from awx.main.access import get_user_queryset, check_user_access, check_user_access_with_errors # noqa - User.add_to_class('get_queryset', get_user_queryset) User.add_to_class('can_access', check_user_access) User.add_to_class('can_access_with_errors', check_user_access_with_errors) diff --git a/awx/main/models/credential.py b/awx/main/models/credential.py index 9026b73313..984967208d 100644 --- a/awx/main/models/credential.py +++ b/awx/main/models/credential.py @@ -9,7 +9,6 @@ from importlib.metadata import entry_points import re from types import SimpleNamespace - # Django from django.apps.config import AppConfig from django.apps.registry import Apps @@ -22,7 +21,6 @@ from django.utils.functional import cached_property from django.utils.timezone import now from django.contrib.auth.models import User - # DRF from rest_framework.serializers import ValidationError as DRFValidationError @@ -50,12 +48,10 @@ from awx.main.models import Team, Organization from awx.main.utils import encrypt_field from awx_plugins.interfaces._temporary_private_licensing_api import detect_server_product_name - # DAB from ansible_base.resource_registry.tasks.sync import get_resource_server_client from ansible_base.resource_registry.utils.settings import resource_server_defined - __all__ = ['Credential', 'CredentialType', 'CredentialInputSource', 'build_safe_env'] logger = logging.getLogger('awx.main.models.credential') diff --git a/awx/main/models/execution_environments.py b/awx/main/models/execution_environments.py index ea74125f8f..925b634a73 100644 --- a/awx/main/models/execution_environments.py +++ b/awx/main/models/execution_environments.py @@ -7,7 +7,6 @@ from awx.api.versioning import reverse from awx.main.models.base import CommonModel from awx.main.validators import validate_container_image_name - __all__ = ['ExecutionEnvironment'] diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index d4c50bc397..ea21e0df8e 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -53,7 +53,6 @@ from awx.main.utils import _inventory_updates from awx.main.utils.safe_yaml import sanitize_jinja from awx.main.utils.execution_environments import get_control_plane_execution_environment - __all__ = ['Inventory', 'Host', 'Group', 'InventorySource', 'InventoryUpdate', 'SmartInventoryMembership', 'HostMetric', 'HostMetricSummaryMonthly'] logger = logging.getLogger('awx.main.models.inventory') diff --git a/awx/main/models/jobs.py b/awx/main/models/jobs.py index 8bd56796d9..ae586a19c7 100644 --- a/awx/main/models/jobs.py +++ b/awx/main/models/jobs.py @@ -6,7 +6,6 @@ import logging import time from urllib.parse import urljoin - # Django from django.conf import settings from django.core.exceptions import ValidationError @@ -55,7 +54,6 @@ from awx.main.models.mixins import ( ) from awx.main.constants import JOB_VARIABLE_PREFIXES - logger = logging.getLogger('awx.main.models.jobs') __all__ = ['JobTemplate', 'JobLaunchConfig', 'Job', 'JobHostSummary', 'SystemJobTemplate', 'SystemJob'] diff --git a/awx/main/models/mixins.py b/awx/main/models/mixins.py index 4215341b0e..ea1a739c8a 100644 --- a/awx/main/models/mixins.py +++ b/awx/main/models/mixins.py @@ -28,7 +28,6 @@ from awx.main.utils.polymorphic import build_polymorphic_ctypes_map from awx.main.fields import AskForField from awx.main.constants import ACTIVE_STATES, org_role_to_permission - logger = logging.getLogger('awx.main.models.mixins') diff --git a/awx/main/models/notifications.py b/awx/main/models/notifications.py index 97a4f1ae63..98d9ce71a7 100644 --- a/awx/main/models/notifications.py +++ b/awx/main/models/notifications.py @@ -33,7 +33,6 @@ from awx.main.notifications.rocketchat_backend import RocketChatBackend from awx.main.notifications.irc_backend import IrcBackend from awx.main.notifications.awssns_backend import AWSSNSBackend - logger = logging.getLogger('awx.main.models.notifications') __all__ = ['NotificationTemplate', 'Notification'] @@ -528,7 +527,7 @@ class JobNotificationMixin(object): return for nt in set(notification_templates.get(self.STATUS_TO_TEMPLATE_TYPE[status], [])): - (msg, body) = self.build_notification_message(nt, status) + msg, body = self.build_notification_message(nt, status) # Use kwargs to force late-binding # https://stackoverflow.com/a/3431699/10669572 diff --git a/awx/main/models/projects.py b/awx/main/models/projects.py index d0b22830ee..93a5029cbd 100644 --- a/awx/main/models/projects.py +++ b/awx/main/models/projects.py @@ -17,7 +17,6 @@ from django.utils.text import slugify from django.core.exceptions import ValidationError from django.utils.timezone import now, make_aware, get_default_timezone - # AWX from awx.api.versioning import reverse from awx.main.models.base import PROJECT_UPDATE_JOB_TYPE_CHOICES, PERM_INVENTORY_DEPLOY diff --git a/awx/main/models/rbac.py b/awx/main/models/rbac.py index 12c104f54f..59b5677a8b 100644 --- a/awx/main/models/rbac.py +++ b/awx/main/models/rbac.py @@ -365,8 +365,7 @@ class Role(models.Model): if len(removals) > 0: for ids in split_ids_for_sqlite(removals): sql_params['ids'] = ','.join(str(x) for x in ids) - cursor.execute( - ''' + cursor.execute(''' DELETE FROM %(ancestors_table)s WHERE descendent_id IN (%(ids)s) AND descendent_id != ancestor_id @@ -378,9 +377,7 @@ class Role(models.Model): WHERE parents.from_role_id = %(ancestors_table)s.descendent_id AND %(ancestors_table)s.ancestor_id = inner_ancestors.ancestor_id ) - ''' - % sql_params - ) + ''' % sql_params) delete_ct += cursor.rowcount @@ -388,8 +385,7 @@ class Role(models.Model): if len(additions) > 0: for ids in split_ids_for_sqlite(additions): sql_params['ids'] = ','.join(str(x) for x in ids) - cursor.execute( - ''' + cursor.execute(''' INSERT INTO %(ancestors_table)s (descendent_id, ancestor_id, role_field, content_type_id, object_id) SELECT from_id, to_id, new_ancestry_list.role_field, new_ancestry_list.content_type_id, new_ancestry_list.object_id FROM ( SELECT roles.id from_id, @@ -419,9 +415,7 @@ class Role(models.Model): AND %(ancestors_table)s.ancestor_id = new_ancestry_list.to_id ) - ''' - % sql_params - ) + ''' % sql_params) insert_ct += cursor.rowcount if insert_ct == 0 and delete_ct == 0: diff --git a/awx/main/models/schedules.py b/awx/main/models/schedules.py index 0e92960b88..0afb546f90 100644 --- a/awx/main/models/schedules.py +++ b/awx/main/models/schedules.py @@ -24,7 +24,6 @@ from awx.main.models.jobs import LaunchTimeConfig from awx.main.utils import ignore_inventory_computed_fields from awx.main.consumers import emit_channel_notification - logger = logging.getLogger('awx.main.models.schedule') __all__ = ['Schedule'] diff --git a/awx/main/models/workflow.py b/awx/main/models/workflow.py index 88df81faf0..136f49f86a 100644 --- a/awx/main/models/workflow.py +++ b/awx/main/models/workflow.py @@ -45,7 +45,6 @@ from awx.main.models.credential import Credential from awx.main.redact import REPLACE_STR from awx.main.utils import ScheduleWorkflowManager - __all__ = [ 'WorkflowJobTemplate', 'WorkflowJob', @@ -939,7 +938,7 @@ class WorkflowApproval(UnifiedJob, JobNotificationMixin): return for nt in self.workflow_job_template.notification_templates["approvals"]: try: - (notification_subject, notification_body) = self.build_approval_notification_message(nt, approval_status) + notification_subject, notification_body = self.build_approval_notification_message(nt, approval_status) except Exception: raise NotImplementedError("build_approval_notification_message() does not exist") diff --git a/awx/main/redact.py b/awx/main/redact.py index 34dc33a98a..5e2388e5ca 100644 --- a/awx/main/redact.py +++ b/awx/main/redact.py @@ -25,7 +25,7 @@ class UriCleaner(object): if o.netloc and ":" in o.netloc: # Handle the special case url http://username:password that can appear in SCM url # on account of a bug? in ansible redaction - (username, password) = o.netloc.split(':') + username, password = o.netloc.split(':') else: text_index += len(match.group(1)) continue diff --git a/awx/main/routing.py b/awx/main/routing.py index 26d44a97bd..25938efe11 100644 --- a/awx/main/routing.py +++ b/awx/main/routing.py @@ -11,7 +11,6 @@ from ansible_base.lib.channels.middleware import DrfAuthMiddlewareStack from awx.main.utils.redis import get_redis_client from . import consumers - logger = logging.getLogger('awx.main.routing') _application = None diff --git a/awx/main/scheduler/dependency_graph.py b/awx/main/scheduler/dependency_graph.py index c0f2801f08..8f0aa73088 100644 --- a/awx/main/scheduler/dependency_graph.py +++ b/awx/main/scheduler/dependency_graph.py @@ -9,7 +9,6 @@ from awx.main.models import ( import logging - logger = logging.getLogger('awx.main.scheduler.dependency_graph') diff --git a/awx/main/scheduler/task_manager.py b/awx/main/scheduler/task_manager.py index 67ed9599f4..5904c47d57 100644 --- a/awx/main/scheduler/task_manager.py +++ b/awx/main/scheduler/task_manager.py @@ -55,7 +55,6 @@ from awx.main.tasks.jobs import dispatch_waiting_jobs import awx.main.analytics.subsystem_metrics as s_metrics from awx.main.utils import decrypt_field - logger = logging.getLogger('awx.main.scheduler') @@ -498,7 +497,7 @@ class TaskManager(TaskBase): task.status = 'waiting' - (start_status, opts) = task.pre_start() + start_status, opts = task.pre_start() if not start_status: task.status = 'failed' if task.job_explanation: diff --git a/awx/main/signals.py b/awx/main/signals.py index 95ad4b197c..a40b41d0c8 100644 --- a/awx/main/signals.py +++ b/awx/main/signals.py @@ -27,7 +27,6 @@ from django.utils import timezone from crum import get_current_request, get_current_user from crum.signals import current_user_getter - # AWX from awx.main.models import ( ActivityStream, diff --git a/awx/main/tasks/facts.py b/awx/main/tasks/facts.py index 68515c4937..c9e7bbfa54 100644 --- a/awx/main/tasks/facts.py +++ b/awx/main/tasks/facts.py @@ -16,7 +16,6 @@ from ansible_base.lib.logging.runtime import log_excess_runtime from awx.main.utils.db import bulk_update_sorted_by_id from awx.main.models import Host - logger = logging.getLogger('awx.main.tasks.facts') system_tracking_logger = logging.getLogger('awx.analytics.system_tracking') diff --git a/awx/main/tasks/host_metrics.py b/awx/main/tasks/host_metrics.py index c4c776159a..c5681f28d5 100644 --- a/awx/main/tasks/host_metrics.py +++ b/awx/main/tasks/host_metrics.py @@ -14,7 +14,6 @@ from awx.conf.license import get_license from ansible_base.lib.utils.db import advisory_lock from awx.main.utils.db import bulk_update_sorted_by_id - logger = logging.getLogger('awx.main.tasks.host_metrics') diff --git a/awx/main/tasks/policy.py b/awx/main/tasks/policy.py index a82410d8cb..e629e919bb 100644 --- a/awx/main/tasks/policy.py +++ b/awx/main/tasks/policy.py @@ -17,7 +17,6 @@ from rest_framework import fields from awx.main import models from awx.main.exceptions import PolicyEvaluationError - # Monkey patching opa_client.base.BaseClient to fix retries and timeout settings _original_opa_base_client_init = BaseClient.__init__ diff --git a/awx/main/tasks/signals.py b/awx/main/tasks/signals.py index 749b07df1f..7bcb57e0e5 100644 --- a/awx/main/tasks/signals.py +++ b/awx/main/tasks/signals.py @@ -2,7 +2,6 @@ import signal import functools import logging - logger = logging.getLogger('awx.main.tasks.signals') diff --git a/awx/main/tasks/system.py b/awx/main/tasks/system.py index 9643059119..6d9656346a 100644 --- a/awx/main/tasks/system.py +++ b/awx/main/tasks/system.py @@ -776,7 +776,7 @@ def _heartbeat_instance_management(): logger.warning(f'Heartbeat skew - interval={(nowtime - last_last_seen).total_seconds():.4f}, expected={settings.CLUSTER_NODE_HEARTBEAT_PERIOD}') else: if settings.AWX_AUTO_DEPROVISION_INSTANCES: - (changed, this_inst) = Instance.objects.register(ip_address=os.environ.get('MY_POD_IP'), node_type='control', node_uuid=settings.SYSTEM_UUID) + changed, this_inst = Instance.objects.register(ip_address=os.environ.get('MY_POD_IP'), node_type='control', node_uuid=settings.SYSTEM_UUID) if changed: logger.warning(f'Recreated instance record {this_inst.hostname} after unexpected removal') this_inst.local_health_check() @@ -958,10 +958,8 @@ def awx_periodic_scheduler(): continue if not can_start: new_unified_job.status = 'failed' - new_unified_job.job_explanation = gettext_noop( - "Scheduled job could not start because it \ - was not in the right state or required manual credentials" - ) + new_unified_job.job_explanation = gettext_noop("Scheduled job could not start because it \ + was not in the right state or required manual credentials") new_unified_job.save(update_fields=['status', 'job_explanation']) new_unified_job.websocket_emit_status("failed") emit_channel_notification('schedules-changed', dict(id=schedule.id, group_name="schedules")) diff --git a/awx/main/tests/data/sleep_task.py b/awx/main/tests/data/sleep_task.py index 59bc6254e2..1293db56dc 100644 --- a/awx/main/tests/data/sleep_task.py +++ b/awx/main/tests/data/sleep_task.py @@ -10,7 +10,6 @@ from awx.main.dispatch.publish import task as old_task from ansible_base.lib.utils.db import advisory_lock - logger = logging.getLogger(__name__) diff --git a/awx/main/tests/functional/__init__.py b/awx/main/tests/functional/__init__.py index 07d89e9739..3139dcf4e7 100644 --- a/awx/main/tests/functional/__init__.py +++ b/awx/main/tests/functional/__init__.py @@ -59,8 +59,7 @@ def app_post_migration(sender, app_config, **kwargs): elif tblname == 'main_systemjobevent': unique_columns = "system_job_id integer NOT NULL" - cur.execute( - f"""CREATE TABLE _unpartitioned_{tblname} ( + cur.execute(f"""CREATE TABLE _unpartitioned_{tblname} ( id bigint NOT NULL, created timestamp with time zone NOT NULL, modified timestamp with time zone NOT NULL, @@ -72,8 +71,7 @@ def app_post_migration(sender, app_config, **kwargs): uuid character varying(1024) NOT NULL, verbosity integer NOT NULL, {unique_columns}); - """ - ) + """) if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite3': diff --git a/awx/main/tests/functional/analytics/test_counts.py b/awx/main/tests/functional/analytics/test_counts.py index dd38c9ef31..015467692d 100644 --- a/awx/main/tests/functional/analytics/test_counts.py +++ b/awx/main/tests/functional/analytics/test_counts.py @@ -66,7 +66,7 @@ def test_database_counts(organization_factory, job_template_factory, workflow_jo @pytest.mark.django_db def test_inventory_counts(organization_factory, inventory_factory): - (inv1, inv2, inv3) = [inventory_factory(f"inv-{i}") for i in range(3)] + inv1, inv2, inv3 = [inventory_factory(f"inv-{i}") for i in range(3)] s1 = inv1.inventory_sources.create(name="src1", source="ec2") s2 = inv1.inventory_sources.create(name="src2", source="file") diff --git a/awx/main/tests/functional/api/test_adhoc.py b/awx/main/tests/functional/api/test_adhoc.py index 983e45029c..b6b0b7c747 100644 --- a/awx/main/tests/functional/api/test_adhoc.py +++ b/awx/main/tests/functional/api/test_adhoc.py @@ -3,7 +3,6 @@ import pytest from awx.api.versioning import reverse - """ def run_test_ad_hoc_command(self, **kwargs): # Post to list to start a new ad hoc command. diff --git a/awx/main/tests/functional/api/test_instance.py b/awx/main/tests/functional/api/test_instance.py index 3afd3184c8..c2e18b765d 100644 --- a/awx/main/tests/functional/api/test_instance.py +++ b/awx/main/tests/functional/api/test_instance.py @@ -11,7 +11,6 @@ from django.http import HttpResponse from rest_framework import status - INSTANCE_KWARGS = dict(hostname='example-host', cpu=6, node_type='execution', memory=36000000000, cpu_capacity=6, mem_capacity=42) diff --git a/awx/main/tests/functional/api/test_schedules.py b/awx/main/tests/functional/api/test_schedules.py index c1cd0779c3..cb49a53d22 100644 --- a/awx/main/tests/functional/api/test_schedules.py +++ b/awx/main/tests/functional/api/test_schedules.py @@ -8,7 +8,6 @@ from awx.api.versioning import reverse from awx.main.models import JobTemplate, Schedule from awx.main.utils.encryption import decrypt_value, get_encryption_key - RRULE_EXAMPLE = 'DTSTART:20151117T050000Z RRULE:FREQ=DAILY;INTERVAL=1;COUNT=1' diff --git a/awx/main/tests/functional/api/test_unified_jobs_view.py b/awx/main/tests/functional/api/test_unified_jobs_view.py index a8c7b53461..9a0955ba80 100644 --- a/awx/main/tests/functional/api/test_unified_jobs_view.py +++ b/awx/main/tests/functional/api/test_unified_jobs_view.py @@ -7,7 +7,6 @@ from awx.main.models import UnifiedJob, ProjectUpdate, InventoryUpdate from awx.main.tests.URI import URI from awx.main.constants import ACTIVE_STATES - TEST_STATES = list(ACTIVE_STATES) TEST_STATES.remove('new') diff --git a/awx/main/tests/functional/api/test_user.py b/awx/main/tests/functional/api/test_user.py index b61ec71615..e3f314b985 100644 --- a/awx/main/tests/functional/api/test_user.py +++ b/awx/main/tests/functional/api/test_user.py @@ -9,7 +9,6 @@ from django.test.utils import override_settings from awx.main.models import User from awx.api.versioning import reverse - # # user creation # diff --git a/awx/main/tests/functional/commands/test_inventory_import.py b/awx/main/tests/functional/commands/test_inventory_import.py index 75a09fc476..6860889bee 100644 --- a/awx/main/tests/functional/commands/test_inventory_import.py +++ b/awx/main/tests/functional/commands/test_inventory_import.py @@ -18,7 +18,6 @@ from awx.main.management.commands import inventory_import from awx.main.models import Inventory, Host, Group, InventorySource from awx.main.utils.mem_inventory import MemGroup - TEST_INVENTORY_CONTENT = { "_meta": {"hostvars": {}}, "all": {"children": ["others", "servers", "ungrouped"], "vars": {"vara": "A"}}, diff --git a/awx/main/tests/functional/commands/test_secret_key_regeneration.py b/awx/main/tests/functional/commands/test_secret_key_regeneration.py index 4084baea08..05584e5101 100644 --- a/awx/main/tests/functional/commands/test_secret_key_regeneration.py +++ b/awx/main/tests/functional/commands/test_secret_key_regeneration.py @@ -12,7 +12,6 @@ from awx.conf.models import Setting from awx.main.management.commands import regenerate_secret_key from awx.main.utils.encryption import encrypt_field, decrypt_field, encrypt_value - PREFIX = '$encrypted$UTF8$AESCBC$' diff --git a/awx/main/tests/functional/test_dispatch.py b/awx/main/tests/functional/test_dispatch.py index b752762fa6..382f858c28 100644 --- a/awx/main/tests/functional/test_dispatch.py +++ b/awx/main/tests/functional/test_dispatch.py @@ -16,7 +16,6 @@ from awx.main.dispatch.publish import task from awx.main.dispatch.worker import BaseWorker, TaskWorker from awx.main.dispatch.periodic import Scheduler - ''' Prevent logger. calls from triggering database operations ''' diff --git a/awx/main/tests/functional/test_python_requirements.py b/awx/main/tests/functional/test_python_requirements.py index d6d486091a..089638e5c2 100644 --- a/awx/main/tests/functional/test_python_requirements.py +++ b/awx/main/tests/functional/test_python_requirements.py @@ -64,7 +64,7 @@ def test_env_matches_requirements_txt(): if skip_line(x): continue x = x.lower() - (pkg_name, pkg_version) = x.split('==') + pkg_name, pkg_version = x.split('==') reqs_actual.append([pkg_name, pkg_version]) reqs_expected = [] @@ -80,7 +80,7 @@ def test_env_matches_requirements_txt(): Special case pkg_name[pkg_subname]==version For this case, we strip out [pkg_subname] ''' - (pkg_name, pkg_version) = line.split('==') + pkg_name, pkg_version = line.split('==') pkg_name = re.sub(r'\[.*\]', '', pkg_name) reqs_expected.append([pkg_name, pkg_version]) diff --git a/awx/main/tests/live/tests/conftest.py b/awx/main/tests/live/tests/conftest.py index 1d4e2e1f85..12b78b514e 100644 --- a/awx/main/tests/live/tests/conftest.py +++ b/awx/main/tests/live/tests/conftest.py @@ -21,7 +21,6 @@ from awx.main.tests import data from awx.main.models import Project, JobTemplate, Organization, Inventory from awx.main.tasks.system import clear_setting_cache - logger = logging.getLogger(__name__) diff --git a/awx/main/tests/live/tests/test_inventory_vars.py b/awx/main/tests/live/tests/test_inventory_vars.py index c574d86a56..611a8fffd9 100644 --- a/awx/main/tests/live/tests/test_inventory_vars.py +++ b/awx/main/tests/live/tests/test_inventory_vars.py @@ -11,7 +11,6 @@ from awx.main.models.organization import Organization from awx.main.models.inventory import Inventory, InventorySource from awx.main.tests.live.tests.conftest import wait_for_job - NAME_PREFIX = "test-ivu" GIT_REPO_FOLDER = "inventory_vars" diff --git a/awx/main/tests/unit/api/test_generics.py b/awx/main/tests/unit/api/test_generics.py index ea8cb38878..05cc72cc19 100644 --- a/awx/main/tests/unit/api/test_generics.py +++ b/awx/main/tests/unit/api/test_generics.py @@ -50,7 +50,7 @@ class TestSubListCreateAttachDetachAPIView: mock_request = mocker.MagicMock(data=dict(id=1)) serializer = SubListCreateAttachDetachAPIView() - (sub_id, res) = serializer.attach_validate(mock_request) + sub_id, res = serializer.attach_validate(mock_request) assert sub_id == 1 assert res is None @@ -59,12 +59,12 @@ class TestSubListCreateAttachDetachAPIView: mock_request = mocker.MagicMock(data=dict(id='foobar')) serializer = SubListCreateAttachDetachAPIView() - (sub_id, res) = serializer.attach_validate(mock_request) + sub_id, res = serializer.attach_validate(mock_request) assert type(res) is Response def test_attach_create_and_associate(self, mocker, get_object_or_400, parent_relationship_factory): - (serializer, mock_parent_relationship) = parent_relationship_factory(SubListCreateAttachDetachAPIView, 'wife') + serializer, mock_parent_relationship = parent_relationship_factory(SubListCreateAttachDetachAPIView, 'wife') create_return_value = mocker.MagicMock(status_code=status.HTTP_201_CREATED) serializer.create = mocker.Mock(return_value=create_return_value) @@ -75,7 +75,7 @@ class TestSubListCreateAttachDetachAPIView: mock_parent_relationship.wife.add.assert_called_with(get_object_or_400.return_value) def test_attach_associate_only(self, mocker, get_object_or_400, parent_relationship_factory): - (serializer, mock_parent_relationship) = parent_relationship_factory(SubListCreateAttachDetachAPIView, 'wife') + serializer, mock_parent_relationship = parent_relationship_factory(SubListCreateAttachDetachAPIView, 'wife') serializer.create = mocker.Mock(return_value=mocker.MagicMock()) mock_request = mocker.MagicMock(data=dict(id=1)) @@ -88,7 +88,7 @@ class TestSubListCreateAttachDetachAPIView: mock_request = mocker.MagicMock(data=dict(id=1)) serializer = SubListCreateAttachDetachAPIView() - (sub_id, res) = serializer.unattach_validate(mock_request) + sub_id, res = serializer.unattach_validate(mock_request) assert sub_id == 1 assert res is None @@ -97,7 +97,7 @@ class TestSubListCreateAttachDetachAPIView: mock_request = mocker.MagicMock(data=dict(id='foobar')) serializer = SubListCreateAttachDetachAPIView() - (sub_id, res) = serializer.unattach_validate(mock_request) + sub_id, res = serializer.unattach_validate(mock_request) assert type(res) is Response @@ -105,13 +105,13 @@ class TestSubListCreateAttachDetachAPIView: mock_request = mocker.MagicMock(data=dict()) serializer = SubListCreateAttachDetachAPIView() - (sub_id, res) = serializer.unattach_validate(mock_request) + sub_id, res = serializer.unattach_validate(mock_request) assert sub_id is None assert type(res) is Response def test_unattach_by_id_ok(self, mocker, parent_relationship_factory, get_object_or_400): - (serializer, mock_parent_relationship) = parent_relationship_factory(SubListCreateAttachDetachAPIView, 'wife') + serializer, mock_parent_relationship = parent_relationship_factory(SubListCreateAttachDetachAPIView, 'wife') mock_request = mocker.MagicMock() mock_sub = mocker.MagicMock(name="object to unattach") get_object_or_400.return_value = mock_sub diff --git a/awx/main/tests/unit/models/test_label.py b/awx/main/tests/unit/models/test_label.py index e049a88578..8017782ffa 100644 --- a/awx/main/tests/unit/models/test_label.py +++ b/awx/main/tests/unit/models/test_label.py @@ -11,7 +11,6 @@ from awx.main.models import ( WorkflowJobNode, ) - mock_query_set = mock.MagicMock() mock_objects = mock.MagicMock(filter=mock.MagicMock(return_value=mock_query_set)) diff --git a/awx/main/tests/unit/scheduler/test_dag_simple.py b/awx/main/tests/unit/scheduler/test_dag_simple.py index 4bb1418157..1cea21e92d 100644 --- a/awx/main/tests/unit/scheduler/test_dag_simple.py +++ b/awx/main/tests/unit/scheduler/test_dag_simple.py @@ -39,6 +39,6 @@ def simple_cycle_1(node_generator): def test_has_cycle(simple_cycle_1): - (g, nodes) = simple_cycle_1 + g, nodes = simple_cycle_1 assert g.has_cycle() is True diff --git a/awx/main/tests/unit/scheduler/test_dag_workflow.py b/awx/main/tests/unit/scheduler/test_dag_workflow.py index 1741d374da..b4681e6b90 100644 --- a/awx/main/tests/unit/scheduler/test_dag_workflow.py +++ b/awx/main/tests/unit/scheduler/test_dag_workflow.py @@ -86,13 +86,13 @@ class TestWorkflowDAG: return (g, wf_root_nodes, wf_leaf_nodes) def test_get_root_nodes(self, workflow_dag_root_children): - (g, wf_root_nodes, ignore) = workflow_dag_root_children + g, wf_root_nodes, ignore = workflow_dag_root_children assert set([n.id for n in wf_root_nodes]) == set([n['node_object'].id for n in g.get_root_nodes()]) class TestDNR: def test_mark_dnr_nodes(self, workflow_dag_1): - (g, nodes) = workflow_dag_1 + g, nodes = workflow_dag_1 r''' 0 @@ -166,7 +166,7 @@ class TestAllWorkflowNodes: return (g, nodes) def test_simple_all_convergence(self, simple_all_convergence): - (g, nodes) = simple_all_convergence + g, nodes = simple_all_convergence dnr_nodes = g.mark_dnr_nodes() assert 0 == len(dnr_nodes), "no nodes should be marked DNR" @@ -197,7 +197,7 @@ class TestAllWorkflowNodes: return (g, nodes) def test_all_converge_edge_case_1(self, workflow_all_converge_1): - (g, nodes) = workflow_all_converge_1 + g, nodes = workflow_all_converge_1 dnr_nodes = g.mark_dnr_nodes() assert 2 == len(dnr_nodes), "node[1] and node[2] should be marked DNR" assert nodes[1] == dnr_nodes[0], "Node 1 should be marked DNR" @@ -233,7 +233,7 @@ class TestAllWorkflowNodes: return (g, nodes) def test_all_converge_edge_case_2(self, workflow_all_converge_2): - (g, nodes) = workflow_all_converge_2 + g, nodes = workflow_all_converge_2 dnr_nodes = g.mark_dnr_nodes() assert 1 == len(dnr_nodes), "1 and only 1 node should be marked DNR" assert nodes[2] == dnr_nodes[0], "Node 3 should be marked DNR" @@ -268,7 +268,7 @@ class TestAllWorkflowNodes: return (g, nodes) def test_workflow_all_converge_will_run(self, workflow_all_converge_will_run): - (g, nodes) = workflow_all_converge_will_run + g, nodes = workflow_all_converge_will_run dnr_nodes = g.mark_dnr_nodes() assert 0 == len(dnr_nodes), "No nodes should get marked DNR" @@ -306,7 +306,7 @@ class TestAllWorkflowNodes: return (g, nodes) def test_workflow_all_converge_while_parent_runs(self, workflow_all_converge_dnr): - (g, nodes) = workflow_all_converge_dnr + g, nodes = workflow_all_converge_dnr dnr_nodes = g.mark_dnr_nodes() assert 0 == len(dnr_nodes), "No nodes should get marked DNR" @@ -315,7 +315,7 @@ class TestAllWorkflowNodes: def test_workflow_all_converge_with_incorrect_parent(self, workflow_all_converge_dnr): # Another tick of the scheduler - (g, nodes) = workflow_all_converge_dnr + g, nodes = workflow_all_converge_dnr nodes[1].job.status = 'successful' dnr_nodes = g.mark_dnr_nodes() assert 1 == len(dnr_nodes), "1 and only 1 node should be marked DNR" @@ -326,7 +326,7 @@ class TestAllWorkflowNodes: def test_workflow_all_converge_runs(self, workflow_all_converge_dnr): # Trick the scheduler again to make sure the convergence node acutally runs - (g, nodes) = workflow_all_converge_dnr + g, nodes = workflow_all_converge_dnr nodes[1].job.status = 'failed' dnr_nodes = g.mark_dnr_nodes() assert 0 == len(dnr_nodes), "No nodes should be marked DNR" @@ -375,7 +375,7 @@ class TestAllWorkflowNodes: return (g, nodes) def test_workflow_all_converge_deep_dnr_tree(self, workflow_all_converge_deep_dnr_tree): - (g, nodes) = workflow_all_converge_deep_dnr_tree + g, nodes = workflow_all_converge_deep_dnr_tree dnr_nodes = g.mark_dnr_nodes() assert 4 == len(dnr_nodes), "All nodes w/ no jobs should be marked DNR" @@ -391,7 +391,7 @@ class TestAllWorkflowNodes: class TestIsWorkflowDone: @pytest.fixture def workflow_dag_2(self, workflow_dag_1): - (g, nodes) = workflow_dag_1 + g, nodes = workflow_dag_1 r''' S0 /\ @@ -416,7 +416,7 @@ class TestIsWorkflowDone: @pytest.fixture def workflow_dag_failed(self, workflow_dag_1): - (g, nodes) = workflow_dag_1 + g, nodes = workflow_dag_1 r''' S0 /\ @@ -453,7 +453,7 @@ class TestIsWorkflowDone: @pytest.fixture def workflow_dag_failure(self, workflow_dag_canceled): - (g, nodes) = workflow_dag_canceled + g, nodes = workflow_dag_canceled nodes[0].job.status = 'failed' return (g, nodes) @@ -463,7 +463,7 @@ class TestIsWorkflowDone: assert g.is_workflow_done() is False def test_workflow_done_and_failed(self, workflow_dag_failed): - (g, nodes) = workflow_dag_failed + g, nodes = workflow_dag_failed assert g.is_workflow_done() is True assert g.has_workflow_failed() == ( @@ -477,7 +477,7 @@ class TestIsWorkflowDone: ) def test_is_workflow_done_no_unified_job_tempalte_end(self, workflow_dag_failed): - (g, nodes) = workflow_dag_failed + g, nodes = workflow_dag_failed nodes[2].unified_job_template = None @@ -492,7 +492,7 @@ class TestIsWorkflowDone: ) def test_is_workflow_done_no_unified_job_tempalte_begin(self, workflow_dag_1): - (g, nodes) = workflow_dag_1 + g, nodes = workflow_dag_1 nodes[0].unified_job_template = None g.mark_dnr_nodes() @@ -508,7 +508,7 @@ class TestIsWorkflowDone: ) def test_canceled_should_fail(self, workflow_dag_canceled): - (g, nodes) = workflow_dag_canceled + g, nodes = workflow_dag_canceled assert g.has_workflow_failed() == ( True, @@ -521,7 +521,7 @@ class TestIsWorkflowDone: ) def test_failure_should_fail(self, workflow_dag_failure): - (g, nodes) = workflow_dag_failure + g, nodes = workflow_dag_failure assert g.has_workflow_failed() == ( True, @@ -555,7 +555,7 @@ class TestBFSNodesToRun: return (g, nodes) def test_cancel_still_runs_children(self, workflow_dag_canceled): - (g, nodes) = workflow_dag_canceled + g, nodes = workflow_dag_canceled g.mark_dnr_nodes() assert set([nodes[1], nodes[2]]) == set(g.bfs_nodes_to_run()) @@ -587,7 +587,7 @@ class TestDocsExample: return (g, nodes) def test_dnr_step(self, complex_dag): - (g, nodes) = complex_dag + g, nodes = complex_dag base_dir = '/awx_devel' g.generate_graphviz_plot(file_name=os.path.join(base_dir, "workflow_step0.gv")) diff --git a/awx/main/tests/unit/test_db.py b/awx/main/tests/unit/test_db.py index ce0b8bbecc..b1ffbfc0d8 100644 --- a/awx/main/tests/unit/test_db.py +++ b/awx/main/tests/unit/test_db.py @@ -9,7 +9,6 @@ import pytest import awx from awx.main.db.profiled_pg.base import RecordedQueryLog - QUERY = {'sql': 'SELECT * FROM main_job', 'time': '.01'} EXPLAIN = 'Seq Scan on public.main_job (cost=0.00..1.18 rows=18 width=86)' diff --git a/awx/main/tests/unit/test_redact.py b/awx/main/tests/unit/test_redact.py index c5585ff75c..f175cbbf7a 100644 --- a/awx/main/tests/unit/test_redact.py +++ b/awx/main/tests/unit/test_redact.py @@ -36,8 +36,7 @@ uri = URI(scheme="https", username="myusername", password="mypasswordwith%40", h TEST_CLEARTEXT.append( { 'uri': uri, - 'text': textwrap.dedent( - """\ + 'text': textwrap.dedent("""\ PLAY [all] ******************************************************************** TASK: [delete project directory before update] ******************************** @@ -59,9 +58,7 @@ TEST_CLEARTEXT.append( localhost : ok=0 changed=0 unreachable=0 failed=1 - """ - % (uri.username, uri.password, str(uri), str(uri)) - ), + """ % (uri.username, uri.password, str(uri), str(uri))), 'host_occurrences': 2, } ) @@ -70,8 +67,7 @@ uri = URI(scheme="https", username="Dhh3U47nmC26xk9PKscV", password="PXPfWW8YzYr TEST_CLEARTEXT.append( { 'uri': uri, - 'text': textwrap.dedent( - """\ + 'text': textwrap.dedent("""\ TASK: [update project using git] ** failed: [localhost] => {"cmd": "/usr/bin/git ls-remote https://REDACTED:********", "failed": true, "rc": 128} stderr: error: Couldn't resolve host '@%s' while accessing %s @@ -81,9 +77,7 @@ TEST_CLEARTEXT.append( msg: error: Couldn't resolve host '@%s' while accessing %s fatal: HTTP request failed - """ - % (uri.host, str(uri), uri.host, str(uri)) - ), + """ % (uri.host, str(uri), uri.host, str(uri))), 'host_occurrences': 4, } ) diff --git a/awx/main/tests/unit/test_views.py b/awx/main/tests/unit/test_views.py index cc0df24089..371e44157a 100644 --- a/awx/main/tests/unit/test_views.py +++ b/awx/main/tests/unit/test_views.py @@ -10,7 +10,6 @@ from awx.main.views import ApiErrorView from awx.api.views import JobList from awx.api.generics import ListCreateAPIView, SubListAttachDetachAPIView - HTTP_METHOD_NAMES = [ 'get', 'post', diff --git a/awx/main/tests/unit/utils/test_analytics_proxy.py b/awx/main/tests/unit/utils/test_analytics_proxy.py index 0096306e57..0a49c33cb9 100644 --- a/awx/main/tests/unit/utils/test_analytics_proxy.py +++ b/awx/main/tests/unit/utils/test_analytics_proxy.py @@ -4,7 +4,6 @@ from unittest import mock from awx.main.utils.analytics_proxy import OIDCClient, TokenType, TokenError - MOCK_TOKEN_RESPONSE = { 'access_token': 'bob-access-token', 'expires_in': 500, diff --git a/awx/main/tests/unit/utils/test_execution_environments.py b/awx/main/tests/unit/utils/test_execution_environments.py index 941623d7e1..1e41890e5f 100644 --- a/awx/main/tests/unit/utils/test_execution_environments.py +++ b/awx/main/tests/unit/utils/test_execution_environments.py @@ -6,7 +6,6 @@ import pytest from awx_plugins.interfaces._temporary_private_container_api import get_incontainer_path - private_data_dir = '/tmp/pdd_iso/awx_xxx' diff --git a/awx/main/utils/encryption.py b/awx/main/utils/encryption.py index 4272e3e07f..d23685d334 100644 --- a/awx/main/utils/encryption.py +++ b/awx/main/utils/encryption.py @@ -9,7 +9,6 @@ from cryptography.fernet import Fernet, InvalidToken from cryptography.hazmat.backends import default_backend from django.utils.encoding import smart_str, smart_bytes - __all__ = ['get_encryption_key', 'encrypt_field', 'decrypt_field', 'encrypt_value', 'decrypt_value', 'encrypt_dict'] logger = logging.getLogger('awx.main.utils.encryption') diff --git a/awx/main/utils/execution_environments.py b/awx/main/utils/execution_environments.py index 7b498d50a1..111b76acc6 100644 --- a/awx/main/utils/execution_environments.py +++ b/awx/main/utils/execution_environments.py @@ -4,7 +4,6 @@ from django.conf import settings from awx.main.models.execution_environments import ExecutionEnvironment - logger = logging.getLogger(__name__) diff --git a/awx/main/utils/handlers.py b/awx/main/utils/handlers.py index 95f078ca84..f6209c755e 100644 --- a/awx/main/utils/handlers.py +++ b/awx/main/utils/handlers.py @@ -27,7 +27,6 @@ from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler from opentelemetry.sdk._logs.export import BatchLogRecordProcessor from opentelemetry.sdk.resources import Resource - __all__ = ['RSysLogHandler', 'SpecialInventoryHandler', 'ColorHandler'] diff --git a/awx/main/utils/inventory_vars.py b/awx/main/utils/inventory_vars.py index 37d9e08f1c..7780a93c73 100644 --- a/awx/main/utils/inventory_vars.py +++ b/awx/main/utils/inventory_vars.py @@ -3,7 +3,6 @@ from typing import TypeAlias, Any from awx.main.models import InventoryGroupVariablesWithHistory - var_value: TypeAlias = Any update_queue: TypeAlias = list[tuple[int, var_value]] diff --git a/awx/main/utils/mem_inventory.py b/awx/main/utils/mem_inventory.py index 58962096fb..3167710d8c 100644 --- a/awx/main/utils/mem_inventory.py +++ b/awx/main/utils/mem_inventory.py @@ -6,7 +6,6 @@ import re import logging from collections import OrderedDict - # Logger is used for any data-related messages so that the log level # can be adjusted on command invocation logger = logging.getLogger('awx.main.commands.inventory_import') diff --git a/awx/main/utils/named_url_graph.py b/awx/main/utils/named_url_graph.py index 632064f0c1..51a85fc684 100644 --- a/awx/main/utils/named_url_graph.py +++ b/awx/main/utils/named_url_graph.py @@ -6,7 +6,6 @@ from collections import deque from django.db import models from django.conf import settings - NAMED_URL_RES_DILIMITER = "++" NAMED_URL_RES_INNER_DILIMITER = "+" NAMED_URL_RES_DILIMITER_ENCODE = "%2B" diff --git a/awx/main/utils/proxy.py b/awx/main/utils/proxy.py index 744c73fed5..0676e8f44a 100644 --- a/awx/main/utils/proxy.py +++ b/awx/main/utils/proxy.py @@ -5,7 +5,6 @@ # DRF from rest_framework.request import Request - """ Note that these methods operate on request.environ. This data is from uwsgi. It is the source data from which request.headers (read-only) is constructed. diff --git a/awx/main/utils/reload.py b/awx/main/utils/reload.py index 29d0784f12..4306a1ae2f 100644 --- a/awx/main/utils/reload.py +++ b/awx/main/utils/reload.py @@ -6,7 +6,6 @@ import subprocess import logging import os - logger = logging.getLogger('awx.main.utils.reload') diff --git a/awx/main/utils/safe_yaml.py b/awx/main/utils/safe_yaml.py index abf21e3428..3dbfffc6a1 100644 --- a/awx/main/utils/safe_yaml.py +++ b/awx/main/utils/safe_yaml.py @@ -1,7 +1,6 @@ import re import yaml - __all__ = ['safe_dump', 'SafeLoader'] diff --git a/awx/main/utils/update_model.py b/awx/main/utils/update_model.py index 0b2998561c..37f35f7091 100644 --- a/awx/main/utils/update_model.py +++ b/awx/main/utils/update_model.py @@ -6,7 +6,6 @@ import time from awx.main.tasks.signals import signal_callback - logger = logging.getLogger('awx.main.tasks.utils') diff --git a/awx/playbooks/library/indirect_instance_count.py b/awx/playbooks/library/indirect_instance_count.py index 27f84d92a5..497178abc7 100644 --- a/awx/playbooks/library/indirect_instance_count.py +++ b/awx/playbooks/library/indirect_instance_count.py @@ -25,7 +25,6 @@ from importlib.resources import files from ansible.plugins.callback import CallbackBase - # NOTE: in Ansible 1.2 or later general logging is available without # this plugin, just set ANSIBLE_LOG_PATH as an environment variable # or log_path in the DEFAULTS section of your ansible configuration diff --git a/awx/ui/conf.py b/awx/ui/conf.py index fa8a2ead52..a666f07dbd 100644 --- a/awx/ui/conf.py +++ b/awx/ui/conf.py @@ -8,7 +8,6 @@ from django.utils.translation import gettext_lazy as _ from awx.conf import register, fields from awx.ui.fields import PendoTrackingStateField, CustomLogoField # noqa - register( 'PENDO_TRACKING_STATE', field_class=PendoTrackingStateField, diff --git a/awx/wsgi.py b/awx/wsgi.py index 2fad3f27da..3505f58b61 100644 --- a/awx/wsgi.py +++ b/awx/wsgi.py @@ -14,7 +14,6 @@ from django.conf import settings # NOQA from django.urls import resolve # NOQA from django.core.wsgi import get_wsgi_application # NOQA - """ WSGI config for AWX project. diff --git a/awxkit/awxkit/api/client.py b/awxkit/awxkit/api/client.py index ef18055f2a..5d5726f339 100644 --- a/awxkit/awxkit/api/client.py +++ b/awxkit/awxkit/api/client.py @@ -5,7 +5,6 @@ import requests from awxkit import exceptions as exc from awxkit.config import config - log = logging.getLogger(__name__) diff --git a/awxkit/awxkit/api/mixins/has_notifications.py b/awxkit/awxkit/api/mixins/has_notifications.py index 7e7b7e8809..1096f28c2e 100644 --- a/awxkit/awxkit/api/mixins/has_notifications.py +++ b/awxkit/awxkit/api/mixins/has_notifications.py @@ -2,7 +2,6 @@ from contextlib import suppress import awxkit.exceptions as exc - notification_endpoints = ("notification_templates", "notification_templates_started", "notification_templates_error", "notification_templates_success") wfjt_notification_endpoints = notification_endpoints + ('notification_templates_approvals',) diff --git a/awxkit/awxkit/api/pages/base.py b/awxkit/awxkit/api/pages/base.py index 99fb08f5f7..d9134a9908 100644 --- a/awxkit/awxkit/api/pages/base.py +++ b/awxkit/awxkit/api/pages/base.py @@ -4,7 +4,6 @@ from awxkit.api.pages import Page from awxkit.config import config import awxkit.exceptions as exc - log = logging.getLogger(__name__) diff --git a/awxkit/awxkit/api/pages/credentials.py b/awxkit/awxkit/api/pages/credentials.py index d7d95aa18b..d27bafcd01 100644 --- a/awxkit/awxkit/api/pages/credentials.py +++ b/awxkit/awxkit/api/pages/credentials.py @@ -21,7 +21,6 @@ from .page import exception_from_status_code from urllib.parse import urljoin - log = logging.getLogger(__name__) diff --git a/awxkit/awxkit/api/pages/execution_environments.py b/awxkit/awxkit/api/pages/execution_environments.py index c63c479a42..028aa51efd 100644 --- a/awxkit/awxkit/api/pages/execution_environments.py +++ b/awxkit/awxkit/api/pages/execution_environments.py @@ -11,7 +11,6 @@ from awxkit.utils import random_title, PseudoNamespace, filter_by_class from . import base from . import page - log = logging.getLogger(__name__) diff --git a/awxkit/awxkit/api/pages/inventory.py b/awxkit/awxkit/api/pages/inventory.py index f75e7f4170..af8b50f099 100644 --- a/awxkit/awxkit/api/pages/inventory.py +++ b/awxkit/awxkit/api/pages/inventory.py @@ -11,7 +11,6 @@ import awxkit.exceptions as exc from . import base from . import page - log = logging.getLogger(__name__) diff --git a/awxkit/awxkit/api/pages/notification_templates.py b/awxkit/awxkit/api/pages/notification_templates.py index b12bbc8c97..7cfdac7948 100644 --- a/awxkit/awxkit/api/pages/notification_templates.py +++ b/awxkit/awxkit/api/pages/notification_templates.py @@ -9,7 +9,6 @@ from awxkit.utils import not_provided, random_title, PseudoNamespace from . import base from . import page - job_results = ('any', 'error', 'success') notification_types = ('awssns', 'email', 'irc', 'pagerduty', 'slack', 'twilio', 'webhook', 'mattermost', 'grafana', 'rocketchat') diff --git a/awxkit/awxkit/api/pages/page.py b/awxkit/awxkit/api/pages/page.py index d6c60d78bd..88c058e2e0 100644 --- a/awxkit/awxkit/api/pages/page.py +++ b/awxkit/awxkit/api/pages/page.py @@ -15,7 +15,6 @@ from awxkit.api.resources import resources from awxkit.config import config import awxkit.exceptions as exc - log = logging.getLogger(__name__) diff --git a/awxkit/awxkit/api/pages/roles.py b/awxkit/awxkit/api/pages/roles.py index 949579160a..f3653af112 100644 --- a/awxkit/awxkit/api/pages/roles.py +++ b/awxkit/awxkit/api/pages/roles.py @@ -5,7 +5,6 @@ from awxkit.api.resources import resources from . import base from . import page - log = logging.getLogger(__name__) diff --git a/awxkit/awxkit/api/utils.py b/awxkit/awxkit/api/utils.py index 719f47904e..69913f2c4c 100644 --- a/awxkit/awxkit/api/utils.py +++ b/awxkit/awxkit/api/utils.py @@ -1,7 +1,6 @@ import logging import re - log = logging.getLogger(__name__) descRE = re.compile(r'^[*] `(\w+)`: [^(]*\((\w+), ([^)]+)\)') diff --git a/awxkit/awxkit/awx/inventory.py b/awxkit/awxkit/awx/inventory.py index 61a31c5754..17d61db15c 100644 --- a/awxkit/awxkit/awx/inventory.py +++ b/awxkit/awxkit/awx/inventory.py @@ -17,9 +17,7 @@ def upload_inventory(ansible_runner, nhosts=10, ini=False): copy_content = '''#!/bin/bash cat <