organized
diff --git a/plstackapi/planetstack/admin.py b/plstackapi/core/admin.py
similarity index 90%
rename from plstackapi/planetstack/admin.py
rename to plstackapi/core/admin.py
index 7b48aae..c3b655f 100644
--- a/plstackapi/planetstack/admin.py
+++ b/plstackapi/core/admin.py
@@ -1,4 +1,4 @@
-from plstackapi.planetstack.models import *
+from plstackapi.core.models import *
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
diff --git a/plstackapi/planetstack/api/__init__.py b/plstackapi/core/api/__init__.py
similarity index 100%
rename from plstackapi/planetstack/api/__init__.py
rename to plstackapi/core/api/__init__.py
diff --git a/plstackapi/planetstack/api/auth.py b/plstackapi/core/api/auth.py
similarity index 100%
rename from plstackapi/planetstack/api/auth.py
rename to plstackapi/core/api/auth.py
diff --git a/plstackapi/planetstack/api/deployment_networks.py b/plstackapi/core/api/deployment_networks.py
similarity index 84%
rename from plstackapi/planetstack/api/deployment_networks.py
rename to plstackapi/core/api/deployment_networks.py
index ed38702..812ca15 100644
--- a/plstackapi/planetstack/api/deployment_networks.py
+++ b/plstackapi/core/api/deployment_networks.py
@@ -1,7 +1,7 @@
from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
-from plstackapi.planetstack.api.auth import auth_check
-from plstackapi.planetstack.models import DeploymentNetwork
+from plstackapi.core.api.auth import auth_check
+from plstackapi.core.models import DeploymentNetwork
def add_deployment_network(auth, name):
diff --git a/plstackapi/planetstack/api/flavors.py b/plstackapi/core/api/flavors.py
similarity index 79%
rename from plstackapi/planetstack/api/flavors.py
rename to plstackapi/core/api/flavors.py
index c6a67b5..a2d0b23 100644
--- a/plstackapi/planetstack/api/flavors.py
+++ b/plstackapi/core/api/flavors.py
@@ -1,7 +1,7 @@
from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
-from plstackapi.planetstack.api.auth import auth_check
-from plstackapi.planetstack.models import Flavor
+from plstackapi.core.api.auth import auth_check
+from plstackapi.core.models import Flavor
def add_flavor(auth, fields={}):
diff --git a/plstackapi/planetstack/api/images.py b/plstackapi/core/api/images.py
similarity index 79%
rename from plstackapi/planetstack/api/images.py
rename to plstackapi/core/api/images.py
index 042219d..b773b0b 100644
--- a/plstackapi/planetstack/api/images.py
+++ b/plstackapi/core/api/images.py
@@ -1,7 +1,7 @@
from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
-from plstackapi.planetstack.api.auth import auth_check
-from plstackapi.planetstack.models import Image
+from plstackapi.core.api.auth import auth_check
+from plstackapi.core.models import Image
def add_image(auth, fields={}):
diff --git a/plstackapi/planetstack/api/keys.py b/plstackapi/core/api/keys.py
similarity index 91%
rename from plstackapi/planetstack/api/keys.py
rename to plstackapi/core/api/keys.py
index b42eed5..af21f41 100644
--- a/plstackapi/planetstack/api/keys.py
+++ b/plstackapi/core/api/keys.py
@@ -1,7 +1,7 @@
from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
-from plstackapi.planetstack.api.auth import auth_check
-from plstackapi.planetstack.models import Key, User
+from plstackapi.core.api.auth import auth_check
+from plstackapi.core.models import Key, User
def lookup_user(fields):
user = None
diff --git a/plstackapi/planetstack/api/roles.py b/plstackapi/core/api/roles.py
similarity index 87%
rename from plstackapi/planetstack/api/roles.py
rename to plstackapi/core/api/roles.py
index 5155767..844fb4f 100644
--- a/plstackapi/planetstack/api/roles.py
+++ b/plstackapi/core/api/roles.py
@@ -1,7 +1,7 @@
from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
-from plstackapi.planetstack.api.auth import auth_check
-from plstackapi.planetstack.models import Role
+from plstackapi.core.api.auth import auth_check
+from plstackapi.core.models import Role
def add_role(auth, name):
diff --git a/plstackapi/planetstack/api/sites.py b/plstackapi/core/api/sites.py
similarity index 92%
rename from plstackapi/planetstack/api/sites.py
rename to plstackapi/core/api/sites.py
index b9899a7..0d07605 100644
--- a/plstackapi/planetstack/api/sites.py
+++ b/plstackapi/core/api/sites.py
@@ -1,7 +1,7 @@
from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
-from plstackapi.planetstack.api.auth import auth_check
-from plstackapi.planetstack.models import Site
+from plstackapi.core.api.auth import auth_check
+from plstackapi.core.models import Site
def add_site(auth, fields):
diff --git a/plstackapi/planetstack/api/users.py b/plstackapi/core/api/users.py
similarity index 94%
rename from plstackapi/planetstack/api/users.py
rename to plstackapi/core/api/users.py
index f02f9d2..6862e30 100644
--- a/plstackapi/planetstack/api/users.py
+++ b/plstackapi/core/api/users.py
@@ -1,7 +1,7 @@
from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
-from plstackapi.planetstack.api.auth import auth_check
-from plstackapi.planetstack.models import User, Site
+from plstackapi.core.api.auth import auth_check
+from plstackapi.core.models import User, Site
def lookup_site(fields):
site = None
diff --git a/plstackapi/planetstack/fixtures/__init__.py b/plstackapi/core/fixtures/__init__.py
similarity index 100%
rename from plstackapi/planetstack/fixtures/__init__.py
rename to plstackapi/core/fixtures/__init__.py
diff --git a/plstackapi/planetstack/fixtures/initial_data.json b/plstackapi/core/fixtures/initial_data.json
similarity index 100%
rename from plstackapi/planetstack/fixtures/initial_data.json
rename to plstackapi/core/fixtures/initial_data.json
diff --git a/plstackapi/planetstack/models.py b/plstackapi/core/models.py
similarity index 95%
rename from plstackapi/planetstack/models.py
rename to plstackapi/core/models.py
index 7561b5e..1ae0a44 100644
--- a/plstackapi/planetstack/models.py
+++ b/plstackapi/core/models.py
@@ -171,7 +171,7 @@
ip_version = models.IntegerField()
start = models.IPAddressField()
end = models.IPAddressField()
- slice = models.ForeignKey(Slice )
+ slice = models.ForeignKey(Slice, related_name='subnets')
def __unicode__(self): return u'%s' % (self.name)
@@ -232,18 +232,6 @@
def __unicode__(self): return u'%s' % (self.name)
- def save(self, *args, **kwds):
- driver = OpenStackDriver()
- if not self.id:
- keypair = driver.create_keypair(name=self.name, key=self.key)
- super(Key, self).save(*args, **kwds)
-
- def delete(self, *args, **kwds):
- driver = OpenStackDriver()
- driver.delete_keypair(self.name)
- super(Key, self).delete(*args, **kwds)
-
-
class Sliver(PlCoreBase):
instance_id = models.CharField(max_length=200, help_text="Nova instance id")
name = models.CharField(max_length=200, help_text="Sliver name")
diff --git a/plstackapi/planetstack/serializers.py b/plstackapi/core/serializers.py
similarity index 98%
rename from plstackapi/planetstack/serializers.py
rename to plstackapi/core/serializers.py
index 4a38059..0ffd86b 100644
--- a/plstackapi/planetstack/serializers.py
+++ b/plstackapi/core/serializers.py
@@ -1,6 +1,6 @@
from django.forms import widgets
from rest_framework import serializers
-from plstackapi.planetstack.models import *
+from plstackapi.core.models import *
class RoleSerializer(serializers.HyperlinkedModelSerializer):
diff --git a/plstackapi/planetstack/urls.py b/plstackapi/core/urls.py
similarity index 79%
rename from plstackapi/planetstack/urls.py
rename to plstackapi/core/urls.py
index a57d251..b34e89a 100644
--- a/plstackapi/planetstack/urls.py
+++ b/plstackapi/core/urls.py
@@ -2,15 +2,15 @@
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
-from plstackapi.planetstack.views.roles import RoleListCreate, RoleRetrieveUpdateDestroy
-from plstackapi.planetstack.views.sites import SiteListCreate, SiteRetrieveUpdateDestroy
-from plstackapi.planetstack.views.users import UserListCreate, UserRetrieveUpdateDestroy
-from plstackapi.planetstack.views.keys import KeyListCreate, KeyRetrieveUpdateDestroy
-from plstackapi.planetstack.views.deployment_networks import DeploymentNetworkListCreate, DeploymentNetworkRetrieveUpdateDestroy
-from plstackapi.planetstack.views.images import ImageListCreate, ImageRetrieveUpdateDestroy
-from plstackapi.planetstack.views.flavors import FlavorListCreate, FlavorRetrieveUpdateDestroy
-from plstackapi.planetstack.views.api_root import api_root
-from plstackapi.planetstack.models import Site
+from plstackapi.core.views.roles import RoleListCreate, RoleRetrieveUpdateDestroy
+from plstackapi.core.views.sites import SiteListCreate, SiteRetrieveUpdateDestroy
+from plstackapi.core.views.users import UserListCreate, UserRetrieveUpdateDestroy
+from plstackapi.core.views.keys import KeyListCreate, KeyRetrieveUpdateDestroy
+from plstackapi.core.views.deployment_networks import DeploymentNetworkListCreate, DeploymentNetworkRetrieveUpdateDestroy
+from plstackapi.core.views.images import ImageListCreate, ImageRetrieveUpdateDestroy
+from plstackapi.core.views.flavors import FlavorListCreate, FlavorRetrieveUpdateDestroy
+from plstackapi.core.models import Site
+from plstackapi.planetstack.api_root import api_root
from rest_framework import generics
admin.autodiscover()
diff --git a/plstackapi/planetstack/views/__init__.py b/plstackapi/core/views/__init__.py
similarity index 100%
rename from plstackapi/planetstack/views/__init__.py
rename to plstackapi/core/views/__init__.py
diff --git a/plstackapi/planetstack/views/api_root.py b/plstackapi/core/views/api_root.py
similarity index 100%
rename from plstackapi/planetstack/views/api_root.py
rename to plstackapi/core/views/api_root.py
diff --git a/plstackapi/planetstack/views/deployment_networks.py b/plstackapi/core/views/deployment_networks.py
similarity index 91%
rename from plstackapi/planetstack/views/deployment_networks.py
rename to plstackapi/core/views/deployment_networks.py
index 73dce95..60e8030 100644
--- a/plstackapi/planetstack/views/deployment_networks.py
+++ b/plstackapi/core/views/deployment_networks.py
@@ -3,8 +3,8 @@
from rest_framework.response import Response
from rest_framework import status
-from plstackapi.planetstack.api.deployment_networks import add_deployment_network, delete_deployment_network, get_deployment_networks
-from plstackapi.planetstack.serializers import DeploymentNetworkSerializer
+from plstackapi.core.api.deployment_networks import add_deployment_network, delete_deployment_network, get_deployment_networks
+from plstackapi.core.serializers import DeploymentNetworkSerializer
from plstackapi.util.request import parse_request
diff --git a/plstackapi/planetstack/views/flavors.py b/plstackapi/core/views/flavors.py
similarity index 91%
rename from plstackapi/planetstack/views/flavors.py
rename to plstackapi/core/views/flavors.py
index a522dfc..ef48499 100644
--- a/plstackapi/planetstack/views/flavors.py
+++ b/plstackapi/core/views/flavors.py
@@ -3,8 +3,8 @@
from rest_framework.response import Response
from rest_framework import status
-from plstackapi.planetstack.api.flavors import add_flavor, delete_flavor, get_flavors
-from plstackapi.planetstack.serializers import FlavorSerializer
+from plstackapi.core.api.flavors import add_flavor, delete_flavor, get_flavors
+from plstackapi.core.serializers import FlavorSerializer
from plstackapi.util.request import parse_request
diff --git a/plstackapi/planetstack/views/images.py b/plstackapi/core/views/images.py
similarity index 91%
rename from plstackapi/planetstack/views/images.py
rename to plstackapi/core/views/images.py
index 8df0aa9..f48cb71 100644
--- a/plstackapi/planetstack/views/images.py
+++ b/plstackapi/core/views/images.py
@@ -3,8 +3,8 @@
from rest_framework.response import Response
from rest_framework import status
-from plstackapi.planetstack.api.images import add_image, delete_image, get_images
-from plstackapi.planetstack.serializers import ImageSerializer
+from plstackapi.core.api.images import add_image, delete_image, get_images
+from plstackapi.core.serializers import ImageSerializer
from plstackapi.util.request import parse_request
diff --git a/plstackapi/planetstack/views/keys.py b/plstackapi/core/views/keys.py
similarity index 93%
rename from plstackapi/planetstack/views/keys.py
rename to plstackapi/core/views/keys.py
index a15d020..6b52b8e 100644
--- a/plstackapi/planetstack/views/keys.py
+++ b/plstackapi/core/views/keys.py
@@ -3,8 +3,8 @@
from rest_framework.response import Response
from rest_framework import status
-from plstackapi.planetstack.api.keys import add_key, delete_key, get_keys, update_key
-from plstackapi.planetstack.serializers import KeySerializer
+from plstackapi.core.api.keys import add_key, delete_key, get_keys, update_key
+from plstackapi.core.serializers import KeySerializer
from plstackapi.util.request import parse_request
diff --git a/plstackapi/planetstack/views/roles.py b/plstackapi/core/views/roles.py
similarity index 92%
rename from plstackapi/planetstack/views/roles.py
rename to plstackapi/core/views/roles.py
index 639b008..05eb77e 100644
--- a/plstackapi/planetstack/views/roles.py
+++ b/plstackapi/core/views/roles.py
@@ -3,8 +3,8 @@
from rest_framework.response import Response
from rest_framework import status
-from plstackapi.planetstack.api.roles import add_role, delete_role, get_roles
-from plstackapi.planetstack.serializers import RoleSerializer
+from plstackapi.core.api.roles import add_role, delete_role, get_roles
+from plstackapi.core.serializers import RoleSerializer
from plstackapi.util.request import parse_request
diff --git a/plstackapi/planetstack/views/sites.py b/plstackapi/core/views/sites.py
similarity index 93%
rename from plstackapi/planetstack/views/sites.py
rename to plstackapi/core/views/sites.py
index e003938..700547c 100644
--- a/plstackapi/planetstack/views/sites.py
+++ b/plstackapi/core/views/sites.py
@@ -3,8 +3,8 @@
from rest_framework.response import Response
from rest_framework import status
-from plstackapi.planetstack.api.sites import add_site, delete_site, get_sites
-from plstackapi.planetstack.serializers import SiteSerializer
+from plstackapi.core.api.sites import add_site, delete_site, get_sites
+from plstackapi.core.serializers import SiteSerializer
from plstackapi.util.request import parse_request
diff --git a/plstackapi/planetstack/views/users.py b/plstackapi/core/views/users.py
similarity index 93%
rename from plstackapi/planetstack/views/users.py
rename to plstackapi/core/views/users.py
index b0445d0..0ec867f 100644
--- a/plstackapi/planetstack/views/users.py
+++ b/plstackapi/core/views/users.py
@@ -3,8 +3,8 @@
from rest_framework.response import Response
from rest_framework import status
-from plstackapi.planetstack.api.users import add_user, delete_user, get_users, update_user
-from plstackapi.planetstack.serializers import UserSerializer
+from plstackapi.core.api.users import add_user, delete_user, get_users, update_user
+from plstackapi.core.serializers import UserSerializer
from plstackapi.util.request import parse_request
diff --git a/plstackapi/importer/plclassic/site_importer.py b/plstackapi/importer/plclassic/site_importer.py
index 9311890..ca89bf5 100644
--- a/plstackapi/importer/plclassic/site_importer.py
+++ b/plstackapi/importer/plclassic/site_importer.py
@@ -1,4 +1,4 @@
-from plstackapi.planetstack.models import Site
+from plstackapi.core.models import Site
class SiteImporter:
diff --git a/plstackapi/importer/plclassic/slice_importer.py b/plstackapi/importer/plclassic/slice_importer.py
index a3b6382..4f57c3b 100644
--- a/plstackapi/importer/plclassic/slice_importer.py
+++ b/plstackapi/importer/plclassic/slice_importer.py
@@ -1,4 +1,4 @@
-from plstackapi.planetstack.models import Slice
+from plstackapi.core.models import Slice
class SliceImporter:
@@ -15,7 +15,7 @@
if not local_sites:
- from models import Site
+ from plstackapi.core.models import Site
sites = Site.objects.all()
for site in sites:
local_sites[site.login_base] = site