diff --git a/adjutant/actions/migrations/0001_initial.py b/adjutant/actions/migrations/0001_initial.py index 12b7254..69a7041 100644 --- a/adjutant/actions/migrations/0001_initial.py +++ b/adjutant/actions/migrations/0001_initial.py @@ -6,7 +6,6 @@ import jsonfield.fields class Migration(migrations.Migration): - dependencies = [ ("api", "0001_initial"), ] diff --git a/adjutant/actions/migrations/0002_action_auto_approve.py b/adjutant/actions/migrations/0002_action_auto_approve.py index 6193e92..3c6f1a1 100644 --- a/adjutant/actions/migrations/0002_action_auto_approve.py +++ b/adjutant/actions/migrations/0002_action_auto_approve.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("actions", "0001_initial"), ] diff --git a/adjutant/actions/migrations/0003_auto_20190610_0205.py b/adjutant/actions/migrations/0003_auto_20190610_0205.py index 5909ae4..07134ed 100644 --- a/adjutant/actions/migrations/0003_auto_20190610_0205.py +++ b/adjutant/actions/migrations/0003_auto_20190610_0205.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("actions", "0002_action_auto_approve"), ] diff --git a/adjutant/actions/migrations/0004_auto_20190610_0209.py b/adjutant/actions/migrations/0004_auto_20190610_0209.py index c796fdb..053b2dd 100644 --- a/adjutant/actions/migrations/0004_auto_20190610_0209.py +++ b/adjutant/actions/migrations/0004_auto_20190610_0209.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("tasks", "0001_initial"), ("actions", "0003_auto_20190610_0205"), diff --git a/adjutant/actions/migrations/0005_alter_action_auto_approve.py b/adjutant/actions/migrations/0005_alter_action_auto_approve.py index 45fdff0..d57cf30 100644 --- a/adjutant/actions/migrations/0005_alter_action_auto_approve.py +++ b/adjutant/actions/migrations/0005_alter_action_auto_approve.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("actions", "0004_auto_20190610_0209"), ] diff --git a/adjutant/actions/v1/misc.py b/adjutant/actions/v1/misc.py index 244f4ab..ed8c19b 100644 --- a/adjutant/actions/v1/misc.py +++ b/adjutant/actions/v1/misc.py @@ -100,7 +100,6 @@ def _build_default_email_group(group_name): class SendAdditionalEmailAction(BaseAction): - serializer = serializers.SendAdditionalEmailSerializer config_group = groups.DynamicNameConfigGroup( diff --git a/adjutant/actions/v1/resources.py b/adjutant/actions/v1/resources.py index 784f59c..4e79dda 100644 --- a/adjutant/actions/v1/resources.py +++ b/adjutant/actions/v1/resources.py @@ -294,7 +294,6 @@ class UpdateProjectQuotasAction(BaseAction, QuotaMixin): ) def _get_email(self): - if CONF.identity.username_is_email: return self.action.task.keystone_user["username"] else: diff --git a/adjutant/actions/v1/users.py b/adjutant/actions/v1/users.py index 4252dce..845672f 100644 --- a/adjutant/actions/v1/users.py +++ b/adjutant/actions/v1/users.py @@ -322,7 +322,6 @@ class EditUserRolesAction(UserIdAction, ProjectMixin, UserMixin): return True def _validate_role_permissions(self): - id_manager = user_store.IdentityManager() current_user_roles = id_manager.get_roles( diff --git a/adjutant/api/migrations/0001_initial.py b/adjutant/api/migrations/0001_initial.py index c21b776..dfba88b 100644 --- a/adjutant/api/migrations/0001_initial.py +++ b/adjutant/api/migrations/0001_initial.py @@ -7,7 +7,6 @@ import adjutant.api.models class Migration(migrations.Migration): - dependencies = [] operations = [ diff --git a/adjutant/api/migrations/0002_auto_20160815_2249.py b/adjutant/api/migrations/0002_auto_20160815_2249.py index 1104920..acd821d 100644 --- a/adjutant/api/migrations/0002_auto_20160815_2249.py +++ b/adjutant/api/migrations/0002_auto_20160815_2249.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("api", "0001_initial"), ] diff --git a/adjutant/api/migrations/0003_task_approved_by.py b/adjutant/api/migrations/0003_task_approved_by.py index 32d5cb9..3199aed 100644 --- a/adjutant/api/migrations/0003_task_approved_by.py +++ b/adjutant/api/migrations/0003_task_approved_by.py @@ -5,7 +5,6 @@ import jsonfield.fields class Migration(migrations.Migration): - dependencies = [ ("api", "0002_auto_20160815_2249"), ] diff --git a/adjutant/api/migrations/0004_auto_20160929_0317.py b/adjutant/api/migrations/0004_auto_20160929_0317.py index cb192b5..3a83aea 100644 --- a/adjutant/api/migrations/0004_auto_20160929_0317.py +++ b/adjutant/api/migrations/0004_auto_20160929_0317.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("api", "0003_task_approved_by"), ] diff --git a/adjutant/api/migrations/0005_auto_20190610_0209.py b/adjutant/api/migrations/0005_auto_20190610_0209.py index f09ea1a..600c72d 100644 --- a/adjutant/api/migrations/0005_auto_20190610_0209.py +++ b/adjutant/api/migrations/0005_auto_20190610_0209.py @@ -5,7 +5,6 @@ from django.db import migrations class Migration(migrations.Migration): - atomic = False dependencies = [ diff --git a/adjutant/api/migrations/0006_auto_20190610_0209.py b/adjutant/api/migrations/0006_auto_20190610_0209.py index c0f3af5..07688e0 100644 --- a/adjutant/api/migrations/0006_auto_20190610_0209.py +++ b/adjutant/api/migrations/0006_auto_20190610_0209.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("tasks", "0001_initial"), ("actions", "0003_auto_20190610_0205"), diff --git a/adjutant/api/migrations/0007_auto_20190610_0209.py b/adjutant/api/migrations/0007_auto_20190610_0209.py index 6977526..d84d1c1 100644 --- a/adjutant/api/migrations/0007_auto_20190610_0209.py +++ b/adjutant/api/migrations/0007_auto_20190610_0209.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("tasks", "0001_initial"), ("actions", "0003_auto_20190610_0205"), diff --git a/adjutant/api/migrations/0008_auto_20190610_0209.py b/adjutant/api/migrations/0008_auto_20190610_0209.py index 34b2fa4..1a5837f 100644 --- a/adjutant/api/migrations/0008_auto_20190610_0209.py +++ b/adjutant/api/migrations/0008_auto_20190610_0209.py @@ -5,7 +5,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("api", "0005_auto_20190610_0209"), ("tasks", "0001_initial"), diff --git a/adjutant/api/v1/openstack.py b/adjutant/api/v1/openstack.py index 8ba090a..0da478c 100644 --- a/adjutant/api/v1/openstack.py +++ b/adjutant/api/v1/openstack.py @@ -29,7 +29,6 @@ from adjutant.config import CONF class UserList(tasks.InviteUser): - url = r"^openstack/users/?$" config_group = groups.DynamicNameConfigGroup( @@ -176,7 +175,6 @@ class UserList(tasks.InviteUser): class UserDetail(BaseDelegateAPI): - url = r"^openstack/users/(?P\w+)/?$" config_group = groups.DynamicNameConfigGroup( @@ -263,7 +261,6 @@ class UserDetail(BaseDelegateAPI): class UserRoles(BaseDelegateAPI): - url = r"^openstack/users/(?P\w+)/roles/?$" config_group = groups.DynamicNameConfigGroup( @@ -338,7 +335,6 @@ class UserRoles(BaseDelegateAPI): class RoleList(BaseDelegateAPI): - url = r"^openstack/roles/?$" @utils.mod_or_admin @@ -490,7 +486,6 @@ class UpdateProjectQuotas(BaseDelegateAPI): @utils.mod_or_admin def post(self, request): - request.data["project_id"] = request.keystone_user["project_id"] self.project_id = request.keystone_user["project_id"] diff --git a/adjutant/api/v1/tasks.py b/adjutant/api/v1/tasks.py index 3dde816..af8db44 100644 --- a/adjutant/api/v1/tasks.py +++ b/adjutant/api/v1/tasks.py @@ -29,7 +29,6 @@ from adjutant.api.v1.base import BaseDelegateAPI class CreateProjectAndUser(BaseDelegateAPI): - url = r"^actions/CreateProjectAndUser/?$" config_group = groups.DynamicNameConfigGroup( @@ -84,7 +83,6 @@ class CreateProjectAndUser(BaseDelegateAPI): class InviteUser(BaseDelegateAPI): - url = r"^actions/InviteUser/?$" task_type = "invite_user_to_project" @@ -118,7 +116,6 @@ class InviteUser(BaseDelegateAPI): class ResetPassword(BaseDelegateAPI): - url = r"^actions/ResetPassword/?$" task_type = "reset_user_password" @@ -164,7 +161,6 @@ class ResetPassword(BaseDelegateAPI): class EditUser(BaseDelegateAPI): - url = r"^actions/EditUser/?$" task_type = "edit_user_roles" @@ -186,7 +182,6 @@ class EditUser(BaseDelegateAPI): class UpdateEmail(BaseDelegateAPI): - url = r"^actions/UpdateEmail/?$" task_type = "update_user_email" diff --git a/adjutant/api/v1/tests/test_api_taskview.py b/adjutant/api/v1/tests/test_api_taskview.py index f24c1dd..3cd619b 100644 --- a/adjutant/api/v1/tests/test_api_taskview.py +++ b/adjutant/api/v1/tests/test_api_taskview.py @@ -860,7 +860,6 @@ class DelegateAPITests(AdjutantAPITestCase): self.assertEqual(len(mail.outbox), 3) def test_update_email_task_invalid_email(self): - user = fake_clients.FakeUser( name="test@example.com", password="123", email="test@example.com" ) @@ -897,7 +896,6 @@ class DelegateAPITests(AdjutantAPITestCase): }, ) def test_update_email_pre_existing_user_with_email(self): - user = fake_clients.FakeUser( name="test@example.com", password="123", email="test@example.com" ) @@ -940,7 +938,6 @@ class DelegateAPITests(AdjutantAPITestCase): }, ) def test_update_email_user_with_email_username_not_email(self): - user = fake_clients.FakeUser( name="test", password="123", email="test@example.com" ) @@ -1006,7 +1003,6 @@ class DelegateAPITests(AdjutantAPITestCase): }, ) def test_update_email_task_username_not_email(self): - user = fake_clients.FakeUser( name="test_user", password="123", email="test@example.com" ) diff --git a/adjutant/api/views.py b/adjutant/api/views.py index 84ff618..2ffc761 100644 --- a/adjutant/api/views.py +++ b/adjutant/api/views.py @@ -48,7 +48,6 @@ class SingleVersionView(APIView): """ def get(self, request): - version = _VERSIONS.get(self.version, {}).copy() if not version: return Response({"error": "Not Found"}, status=404) diff --git a/adjutant/common/openstack_clients.py b/adjutant/common/openstack_clients.py index 0d364fc..2ebba72 100644 --- a/adjutant/common/openstack_clients.py +++ b/adjutant/common/openstack_clients.py @@ -42,7 +42,6 @@ def get_auth_session(): """Returns a global auth session to be shared by all clients""" global client_auth_session if not client_auth_session: - auth = v3.Password( username=CONF.identity.auth.username, password=CONF.identity.auth.password, diff --git a/adjutant/common/tests/fake_clients.py b/adjutant/common/tests/fake_clients.py index bd12c44..c53dfbc 100644 --- a/adjutant/common/tests/fake_clients.py +++ b/adjutant/common/tests/fake_clients.py @@ -217,7 +217,6 @@ class FakeManager(object): for assignment in identity_cache["role_assignments"]: if assignment.scope["project"]["id"] == project.id: - user = users.get(assignment.user["id"]) if not user: user = self.get_user(assignment.user["id"]) @@ -315,7 +314,6 @@ class FakeManager(object): assignment.user["id"] == user.id and assignment.scope["project"]["id"] == project.id ): - if ( assignment.scope.get("OS-INHERIT:inherited_to") and not inherited ) or ( @@ -735,13 +733,11 @@ class FakeOctaviaClient(object): class FakeTroveClient(object): class FakeTroveQuotaManager(object): - FakeTroveResource = namedtuple( "FakeTroveResource", ["resource", "in_use", "reserved", "limit"] ) def __init__(self, region): - global trove_cache self.region = region if region not in trove_cache: diff --git a/adjutant/common/user_store.py b/adjutant/common/user_store.py index 2ee0bfc..928fd8e 100644 --- a/adjutant/common/user_store.py +++ b/adjutant/common/user_store.py @@ -143,7 +143,6 @@ class IdentityManager(object): # pragma: no cover def create_user( self, name, password, email, created_on, domain=None, default_project=None ): - user = self.ks_client.users.create( name=name, password=password, diff --git a/adjutant/tasks/migrations/0001_initial.py b/adjutant/tasks/migrations/0001_initial.py index b378381..27fc602 100644 --- a/adjutant/tasks/migrations/0001_initial.py +++ b/adjutant/tasks/migrations/0001_initial.py @@ -8,7 +8,6 @@ import jsonfield.fields class Migration(migrations.Migration): - dependencies = [ ("api", "0005_auto_20190610_0209"), ] diff --git a/adjutant/tasks/migrations/0002_auto_20190619_0613.py b/adjutant/tasks/migrations/0002_auto_20190619_0613.py index ea64afa..94019d7 100644 --- a/adjutant/tasks/migrations/0002_auto_20190619_0613.py +++ b/adjutant/tasks/migrations/0002_auto_20190619_0613.py @@ -6,7 +6,6 @@ import jsonfield.fields class Migration(migrations.Migration): - dependencies = [ ("tasks", "0001_initial"), ] diff --git a/adjutant/tasks/v1/base.py b/adjutant/tasks/v1/base.py index 1385c91..f073533 100644 --- a/adjutant/tasks/v1/base.py +++ b/adjutant/tasks/v1/base.py @@ -28,7 +28,6 @@ from adjutant import exceptions def make_task_config(task_class): - config_group = groups.DynamicNameConfigGroup() config_group.register_child_config( fields.BoolConfig( @@ -245,7 +244,6 @@ class BaseTask(object): return hashlib.sha256(str(hashable_list).encode("utf-8")).hexdigest() def _handle_duplicates(self, hash_key): - duplicate_tasks = Task.objects.filter( hash_key=hash_key, completed=0, cancelled=0 ) @@ -468,7 +466,6 @@ class BaseTask(object): token.delete() def submit(self, token_data=None, keystone_user=None): - self.confirm_state(approved=True, completed=False, cancelled=False) required_fields = set() diff --git a/tox.ini b/tox.ini index fcef6e6..f05ef56 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,5 @@ [tox] envlist = py3,pep8,black_check,cover_report -skipsdist = True minversion = 3.1.1 ignore_basepython_conflict = True @@ -15,7 +14,7 @@ commands = find adjutant -type f -name "*.pyc" -delete adjutant-api test {posargs} setenv = VIRTUAL_ENV={envdir} -whitelist_externals = +allowlist_externals = find [testenv:pep8]