removing refrences to keys model
diff --git a/planetstack/core/api/keys.py b/planetstack/core/api/keys.py
deleted file mode 100644
index 3528cd3..0000000
--- a/planetstack/core/api/keys.py
+++ /dev/null
@@ -1,58 +0,0 @@
-from types import StringTypes
-from django.contrib.auth import authenticate
-from openstack.manager import OpenStackManager
-from core.models import Key
-from core.api.users import _get_users
-
-
-def _get_keys(filter):
- if isinstance(filter, StringTypes) and filter.isdigit():
- filter = int(filter)
- if isinstance(filter, int):
- keys = Key.objects.filter(id=filter)
- elif isinstance(filter, StringTypes):
- keys = Key.objects.filter(name=filter)
- elif isinstance(filter, dict):
- keys = Key.objects.filter(**filter)
- else:
- keys = []
- return keys
-
-def add_key(auth, fields):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
- manager = OpenStackManager(auth=auth, caller = user)
-
- # look up user object
- users = _get_users(fields.get('user'))
- if users: fields['user'] = users[0]
- # save
- key = Key(**fields)
- key.os_manager = manager
- key.save()
- return key
-
-def update_key(auth, id, **fields):
- return
-
-def delete_key(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- auth['tenant'] = user.site.login_base
- manager = OpenStackManager(auth=auth, caller = user)
-
- keys = _get_keys(filter)
- for key in keys:
- key.os_manager = manager
- key.delete()
- return 1
-
-def get_keys(auth, filter={}):
- user = authenticate(username=auth.get('username'),
- password=auth.get('password'))
- keys = _get_keys(filter)
- return keys
-
-
-
diff --git a/planetstack/core/serializers.py b/planetstack/core/serializers.py
index 78bc553..00d7160 100644
--- a/planetstack/core/serializers.py
+++ b/planetstack/core/serializers.py
@@ -170,7 +170,6 @@
serializerLookUp = {
Role: RoleSerializer,
User: UserSerializer,
- Key: KeySerializer,
Site: SiteSerializer,
SitePrivilege: SitePrivilegeSerializer,
Slice: SliceSerializer,
diff --git a/planetstack/core/views/keys.py b/planetstack/core/views/keys.py
deleted file mode 100644
index a5d0995..0000000
--- a/planetstack/core/views/keys.py
+++ /dev/null
@@ -1,66 +0,0 @@
-from django.http import Http404
-from rest_framework.views import APIView
-from rest_framework.response import Response
-from rest_framework import status
-
-from core.api.keys import add_key, delete_key, get_keys, update_key
-from core.serializers import KeySerializer
-from util.request import parse_request
-
-
-class KeyListCreate(APIView):
- """
- List all users or create a new key.
- """
-
- def post(self, request, format = None):
- data = parse_request(request.DATA)
- if 'auth' not in data:
- return Response(status=status.HTTP_400_BAD_REQUEST)
- elif 'key' in data:
- key = add_key(data['auth'], data['key'])
- serializer = KeySerializer(key)
- return Response(serializer.data, status=status.HTTP_201_CREATED)
- else:
- keys = get_keys(data['auth'])
- serializer = KeySerializer(keys, many=True)
- return Response(serializer.data)
-
-
-class KeyRetrieveUpdateDestroy(APIView):
- """
- Retrieve, update or delete a key
- """
-
- def post(self, request, pk, format=None):
- """Retrieve a key"""
- data = parse_request(request.DATA)
- if 'auth' not in data:
- return Response(status=status.HTTP_400_BAD_REQUEST)
- keys = get_keys(data['auth'], pk)
- if not keys:
- return Response(status=status.HTTP_404_NOT_FOUND)
- serializer = KeySerializer(keys[0])
- return Response(serializer.data)
-
- def put(self, request, pk, format=None):
- """update a key"""
- data = parse_request(request.DATA)
- if 'auth' not in data:
- return Response(status=status.HTTP_400_BAD_REQUEST)
- elif 'key' not in data:
- return Response(status=status.HTTP_400_BAD_REQUEST)
-
- key = update_key(pk, data['key'])
- serializer = KeySerializer(key)
- return Response(serializer.data)
-
- def delete(self, request, pk, format=None):
- data = parse_request(request.DATA)
- if 'auth' not in data:
- return Response(status=status.HTTP_400_BAD_REQUEST)
- delete_key(data['auth'], pk)
- return Response(status=status.HTTP_204_NO_CONTENT)
-
-
-
diff --git a/planetstack/planetstack/urls.py b/planetstack/planetstack/urls.py
index 3b2e128..30eed05 100644
--- a/planetstack/planetstack/urls.py
+++ b/planetstack/planetstack/urls.py
@@ -9,7 +9,6 @@
from core.views.slices import SliceListCreate, SliceRetrieveUpdateDestroy
from core.views.slice_memberships import SliceMembershipListCreate, SliceMembershipRetrieveUpdateDestroy
from core.views.slivers import SliverListCreate, SliverRetrieveUpdateDestroy
-from core.views.keys import KeyListCreate, KeyRetrieveUpdateDestroy
from core.views.deployment_networks import DeploymentListCreate, DeploymentRetrieveUpdateDestroy
from core.views.images import ImageListCreate, ImageRetrieveUpdateDestroy
from core.views.nodes import NodeListCreate, NodeRetrieveUpdateDestroy
@@ -38,9 +37,6 @@
url(r'^plstackapi/users/$', UserListCreate.as_view(), name='user-list'),
url(r'^plstackapi/users/(?P<pk>[a-zA-Z0-9_\-]+)/$', UserRetrieveUpdateDestroy.as_view(), name='user-detail'),
- url(r'^plstackapi/keys/$', KeyListCreate.as_view(), name='key-list'),
- url(r'^plstackapi/keys/(?P<pk>[a-zA-Z0-9_\-]+)/$', KeyRetrieveUpdateDestroy.as_view(), name='key-detail'),
-
url(r'^plstackapi/sites/$', SiteListCreate.as_view(), name='site-list'),
url(r'^plstackapi/sites/(?P<pk>[a-zA-Z0-9_\-]+)/$', SiteRetrieveUpdateDestroy.as_view(), name='site-detail'),