Skip to content

Commit

Permalink
[AAP-9727] Remove /tasks endpoint (#665)
Browse files Browse the repository at this point in the history
* remove /tasks endpoints
* remove /inventory model

JIRA: AAP-9727
  • Loading branch information
Dostonbek1 authored Feb 9, 2024
1 parent 701926c commit 61272d2
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 346 deletions.
4 changes: 0 additions & 4 deletions src/aap_eda/api/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
RulesetOutSerializer,
RulesetSerializer,
)
from .tasks import TaskRefSerializer, TaskSerializer
from .user import (
AwxTokenCreateSerializer,
AwxTokenSerializer,
Expand Down Expand Up @@ -94,9 +93,6 @@
"RulesetSerializer",
"RuleOutSerializer",
"RuleSerializer",
# tasks
"TaskRefSerializer",
"TaskSerializer",
# activations
"ActivationSerializer",
"ActivationListSerializer",
Expand Down
3 changes: 0 additions & 3 deletions src/aap_eda/api/serializers/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class Meta:
"git_hash",
"import_state",
"import_error",
"import_task_id",
"created_at",
"modified_at",
]
Expand Down Expand Up @@ -98,7 +97,6 @@ class Meta:
"git_hash",
"import_state",
"import_error",
"import_task_id",
"created_at",
"modified_at",
]
Expand Down Expand Up @@ -126,7 +124,6 @@ def to_representation(self, project):
"credential": credential,
"import_state": project["import_state"],
"import_error": project["import_error"],
"import_task_id": project["import_task_id"],
"created_at": project["created_at"],
"modified_at": project["modified_at"],
}
Expand Down
46 changes: 0 additions & 46 deletions src/aap_eda/api/serializers/tasks.py

This file was deleted.

1 change: 0 additions & 1 deletion src/aap_eda/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
router.register("rulesets", views.RulesetViewSet)
router.register("rules", views.RuleViewSet)
router.register("roles", views.RoleViewSet)
router.register("tasks", views.TaskViewSet, basename="task")
router.register("activations", views.ActivationViewSet)
router.register("activation-instances", views.ActivationInstanceViewSet)
router.register("audit-rules", views.AuditRuleViewSet)
Expand Down
3 changes: 0 additions & 3 deletions src/aap_eda/api/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
RulesetViewSet,
RuleViewSet,
)
from .tasks import TaskViewSet
from .user import CurrentUserAwxTokenViewSet, CurrentUserView, UserViewSet

__all__ = (
Expand All @@ -38,8 +37,6 @@
"RulebookViewSet",
"RulesetViewSet",
"RuleViewSet",
# tasks
"TaskViewSet",
# activations
"ActivationViewSet",
"ActivationInstanceViewSet",
Expand Down
68 changes: 0 additions & 68 deletions src/aap_eda/api/views/tasks.py

This file was deleted.

9 changes: 0 additions & 9 deletions src/aap_eda/core/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ class ResourceType(DjangoStrEnum):
ACTIVATION_INSTANCE = "activation_instance"
AUDIT_RULE = "audit_rule"
AUDIT_EVENT = "audit_event"
TASK = "task"
USER = "user"
PROJECT = "project"
INVENTORY = "inventory"
EXTRA_VAR = "extra_var"
RULEBOOK = "rulebook"
ROLE = "role"
Expand All @@ -63,13 +61,6 @@ class Action(DjangoStrEnum):
RESTART = "restart"


class InventorySource(DjangoStrEnum):
PROJECT = "project"
COLLECTION = "collection"
USER_DEFINED = "user_defined"
EXECUTION_ENV = "execution_env"


# TODO: rename to "RulebookProcessStatus" or "ParentProcessStatus"
class ActivationStatus(DjangoStrEnum):
STARTING = "starting"
Expand Down
12 changes: 0 additions & 12 deletions src/aap_eda/core/management/commands/create_initial_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@
"activation_instance": ["read", "delete"],
"audit_rule": ["read"],
"audit_event": ["read"],
"task": ["read"],
"user": ["create", "read", "update", "delete"],
"project": ["create", "read", "update", "delete"],
"inventory": ["create", "read", "update", "delete"],
"extra_var": ["create", "read", "update", "delete"],
"rulebook": ["create", "read", "update", "delete"],
"role": ["create", "read", "update", "delete"],
Expand All @@ -56,9 +54,7 @@
"activation_instance": ["read"],
"audit_rule": ["read"],
"audit_event": ["read"],
"task": ["read"],
"project": ["create", "read", "update", "delete"],
"inventory": ["create", "read", "update", "delete"],
"extra_var": ["create", "read", "update", "delete"],
"rulebook": ["create", "read", "update", "delete"],
"decision_environment": ["create", "read", "update", "delete"],
Expand Down Expand Up @@ -86,9 +82,7 @@
"activation_instance": ["read", "delete"],
"audit_rule": ["read"],
"audit_event": ["read"],
"task": ["read"],
"project": ["create", "read", "update", "delete"],
"inventory": ["create", "read", "update", "delete"],
"extra_var": ["create", "read", "update", "delete"],
"rulebook": ["create", "read", "update", "delete"],
"decision_environment": ["create", "read", "update", "delete"],
Expand All @@ -107,9 +101,7 @@
"activation_instance": ["read"],
"audit_rule": ["read"],
"audit_event": ["read"],
"task": ["read"],
"project": ["read"],
"inventory": ["read"],
"extra_var": ["read"],
"rulebook": ["read"],
"decision_environment": ["read"],
Expand All @@ -125,10 +117,8 @@
"activation_instance": ["read"],
"audit_rule": ["read"],
"audit_event": ["read"],
"task": ["read"],
"user": ["read"],
"project": ["read"],
"inventory": ["read"],
"extra_var": ["read"],
"rulebook": ["read"],
"role": ["read"],
Expand All @@ -145,9 +135,7 @@
"activation_instance": ["read"],
"audit_rule": ["read"],
"audit_event": ["read"],
"task": ["read"],
"project": ["read"],
"inventory": ["read"],
"extra_var": ["read"],
"rulebook": ["read"],
"decision_environment": ["read"],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 4.2.7 on 2024-02-09 14:43

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("core", "0022_activationrequestqueue_process_parent_id_and_more"),
]

operations = [
migrations.AlterField(
model_name="permission",
name="resource_type",
field=models.TextField(
choices=[
("activation", "activation"),
("activation_instance", "activation_instance"),
("audit_rule", "audit_rule"),
("audit_event", "audit_event"),
("user", "user"),
("project", "project"),
("extra_var", "extra_var"),
("rulebook", "rulebook"),
("role", "role"),
("decision_environment", "decision_environment"),
("credential", "credential"),
]
),
),
migrations.DeleteModel(
name="Inventory",
),
]
2 changes: 0 additions & 2 deletions src/aap_eda/core/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from .credential import Credential
from .decision_environment import DecisionEnvironment
from .event_stream import EventStream
from .inventory import Inventory
from .job import (
ActivationInstanceJobInstance,
Job,
Expand Down Expand Up @@ -47,7 +46,6 @@
"AuditEvent",
"AuditRule",
"ExtraVar",
"Inventory",
"JobInstanceEvent",
"JobInstanceHost",
"JobInstance",
Expand Down
49 changes: 0 additions & 49 deletions src/aap_eda/core/models/inventory.py

This file was deleted.

6 changes: 0 additions & 6 deletions tests/integration/api/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def test_retrieve_project_failed_state(client: APIClient):
data = response.json()

assert data["import_state"] == "failed"
assert data["import_task_id"] == "3677eb4a-de4a-421a-a73b-411aa502484d"
assert data["import_error"] == "Unexpected error. Please contact support."

assert_project_data_details(data, project)
Expand Down Expand Up @@ -496,18 +495,13 @@ def assert_project_data_details(data: Dict[str, Any], project: models.Project):


def model_to_data_common(project: models.Project):
import_task_id = project.import_task_id
if import_task_id is not None:
import_task_id = str(import_task_id)

return {
"id": project.id,
"url": project.url,
"name": project.name,
"description": project.description,
"git_hash": project.git_hash,
"import_state": project.import_state,
"import_task_id": import_task_id,
"import_error": project.import_error,
"created_at": project.created_at.strftime(DATETIME_FORMAT),
"modified_at": project.modified_at.strftime(DATETIME_FORMAT),
Expand Down
Loading

0 comments on commit 61272d2

Please sign in to comment.