Merge branch 'master' of github.com:open-cloud/xos into feature/subscriber-portal
# Conflicts:
# xos/core/xoslib/methods/loginview.py
diff --git a/xos/configurations/cord/cord.yaml b/xos/configurations/cord/cord.yaml
index 89db720..e878322 100644
--- a/xos/configurations/cord/cord.yaml
+++ b/xos/configurations/cord/cord.yaml
@@ -118,7 +118,7 @@
"defaultVlan" : "1"
},
"basic" : {
- "driver" : "default"
+ "driver" : "pmc-olt"
}
}
}
diff --git a/xos/core/xoslib/methods/loginview.py b/xos/core/xoslib/methods/loginview.py
index 51e940d..975a65b 100755
--- a/xos/core/xoslib/methods/loginview.py
+++ b/xos/core/xoslib/methods/loginview.py
@@ -16,6 +16,8 @@
import django.middleware.csrf
from xos.exceptions import *
from django.forms.models import model_to_dict
+from django.contrib.sessions.backends.db import SessionStore
+from django.contrib.sessions.models import Session
def date_handler(obj):
return obj.isoformat() if hasattr(obj, 'isoformat') else obj
@@ -68,4 +70,33 @@
return self.do_login(request, username, password)
+class LogoutView(APIView):
+ method_kind = "list"
+ method_name = "logout"
+
+ def do_logout(self, request, sessionid):
+ if not sessionid:
+ raise XOSMissingField("No xossessionid specified")
+
+ # Make sure the session exists. This prevents us from accidentally
+ # creating empty sessions with SessionStore()
+ session = Session.objects.filter(session_key=sessionid)
+ if not session:
+ # session doesn't exist
+ raise PermissionDenied("Session does not exist")
+
+ session = SessionStore(session_key=sessionid)
+ if "auth" in session:
+ del session["auth"]
+ session.save()
+
+ return Response("Logged Out")
+
+ def get(self, request, format=None):
+ sessionid = request.GET.get("xossessionid", None)
+ return self.do_logout(request, sessionid)
+
+ def post(self, request, format=None):
+ sessionid = request.DATA.get("xossessionid", None)
+ return self.do_logout(request, sessionid)
diff --git a/xos/synchronizers/base/xos-synchronizer.py b/xos/synchronizers/base/xos-synchronizer.py
index 3fffd33..493b94a 100644
--- a/xos/synchronizers/base/xos-synchronizer.py
+++ b/xos/synchronizers/base/xos-synchronizer.py
@@ -8,7 +8,7 @@
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
from synchronizers.base.backend import Backend
from xos.config import Config, DEFAULT_CONFIG_FN
-from core.models import Instance
+from core.models import Instance,NetworkTemplate
from xos.logger import Logger, logging, logger
from django.db import ProgrammingError
import time
@@ -67,9 +67,12 @@
while not models_active:
try:
_ = Instance.objects.first()
+ _ = NetworkTemplate.objects.first()
models_active = True
- except ProgrammingError:
+ except Exception,e:
+ logger.info(str(e))
logger.info('Waiting for data model to come up before starting...')
+ time.sleep(10)
wait = True
if (wait):
diff --git a/xos/synchronizers/openstack/xos-synchronizer.py b/xos/synchronizers/openstack/xos-synchronizer.py
index 3fffd33..493b94a 100644
--- a/xos/synchronizers/openstack/xos-synchronizer.py
+++ b/xos/synchronizers/openstack/xos-synchronizer.py
@@ -8,7 +8,7 @@
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
from synchronizers.base.backend import Backend
from xos.config import Config, DEFAULT_CONFIG_FN
-from core.models import Instance
+from core.models import Instance,NetworkTemplate
from xos.logger import Logger, logging, logger
from django.db import ProgrammingError
import time
@@ -67,9 +67,12 @@
while not models_active:
try:
_ = Instance.objects.first()
+ _ = NetworkTemplate.objects.first()
models_active = True
- except ProgrammingError:
+ except Exception,e:
+ logger.info(str(e))
logger.info('Waiting for data model to come up before starting...')
+ time.sleep(10)
wait = True
if (wait):