diff --git a/cloudigrade/internal/urls.py b/cloudigrade/internal/urls.py index 2aecbbc6b..0cbca5aba 100644 --- a/cloudigrade/internal/urls.py +++ b/cloudigrade/internal/urls.py @@ -107,6 +107,7 @@ class PermissiveAPIRootView(routers.APIRootView): # URL patterns for potentially-destructive custom commands. urlpatterns += [ path("cache//", views.cache_keys, name="internal-cache"), + path("clear_cache/", views.clear_cache, name="internal-clear-cache"), path( "delete_cloud_accounts_not_in_sources/", views.delete_cloud_accounts_not_in_sources, diff --git a/cloudigrade/internal/views.py b/cloudigrade/internal/views.py index be5879624..1af54180a 100644 --- a/cloudigrade/internal/views.py +++ b/cloudigrade/internal/views.py @@ -396,6 +396,17 @@ def cache_keys(request, key): return Response(data=None) +@api_view(["POST"]) +@authentication_classes([IdentityHeaderAuthenticationInternal]) +@permission_classes([permissions.AllowAny]) +@schema(None) +def clear_cache(request): + """Post clear all cache keys.""" + logger.info(_("Clearing all cache keys")) + cache.clear() + return Response(data=None) + + @api_view(["GET"]) @authentication_classes([IdentityHeaderAuthenticationInternal]) @permission_classes([permissions.AllowAny])