summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamana Juvvadi <rjuvvadi@hcl.com>2011-05-07 23:25:31 -0500
committerRamana Juvvadi <rjuvvadi@hcl.com>2011-05-07 23:25:31 -0500
commit71cd6006bd29b804560b564bfff2d9b1609b94bd (patch)
treea6eddc03aa13aabc01b5dcbdf14b0f189b2d4faf
parent3eb1f32f15b0ed128220c4a5afd40e23e331ca6a (diff)
in the middle of get_version_info
-rw-r--r--bin/scripts/keystone-control3
-rwxr-xr-xkeystone/auth_server.py40
-rw-r--r--test/unit/test_identity.py4
3 files changed, 43 insertions, 4 deletions
diff --git a/bin/scripts/keystone-control b/bin/scripts/keystone-control
index fec3bdfe..5982a137 100644
--- a/bin/scripts/keystone-control
+++ b/bin/scripts/keystone-control
@@ -26,10 +26,11 @@ import optparse
import os
import sys
-# If ../glance/__init__.py exists, add ../ to Python search path, so that
+# If ../../keystone/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
+ os.pardir,
os.pardir))
if os.path.exists(os.path.join(possible_topdir, 'keystone', '__init__.py')):
sys.path.insert(0, possible_topdir)
diff --git a/keystone/auth_server.py b/keystone/auth_server.py
index ec8bf6df..61b2b2d0 100755
--- a/keystone/auth_server.py
+++ b/keystone/auth_server.py
@@ -50,11 +50,13 @@ from webob.exc import (HTTPNotFound,
HTTPBadRequest)
POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
- os.pardir,
+ os.pardir,os.pardir,
os.pardir))
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'keystone', '__init__.py')):
sys.path.insert(0, POSSIBLE_TOPDIR)
+
+
from queryext import exthandler
from keystone.common import wsgi
import keystone.logic.service as serv
@@ -62,6 +64,11 @@ import keystone.logic.types.tenant as tenants
import keystone.logic.types.auth as auth
import keystone.logic.types.fault as fault
import keystone.logic.types.user as users
+import bottle
+
+
+VERSION_STATUS = "ALPHA"
+VERSION_DATE = "2011-04-23T00:00:00Z"
service = serv.IDMService()
@@ -108,6 +115,30 @@ def send_result(code, req, result):
return
return content
+class MiscController(wsgi.Controller):
+
+ def __init__(self, options):
+ self.options = options
+
+ def get_version_info(self, req):
+ response=Response()
+ if is_xml_response(req):
+ resp_file = os.path.join(POSSIBLE_TOPDIR,
+ "keystone/content/version.xml.tpl")
+ response.content_type = "application/xml"
+ else:
+ resp_file = os.path.join(POSSIBLE_TOPDIR,
+ "keystone/content/version.json.tpl")
+ response.content_type = "application/json"
+
+ print resp_file
+ hostname = req.environ.get("SERVER_NAME")
+ port = req.environ.get("SERVER_PORT")
+
+ return bottle.template(resp_file, HOST=hostname, PORT=port,
+ VERSION_STATUS=VERSION_STATUS,
+ VERSION_DATE=VERSION_DATE)
+
class AuthController(wsgi.Controller):
@@ -352,6 +383,13 @@ class Auth_API(wsgi.Router):
action="delete_user", conditions=dict(method=["DELETE"]))
+ # Miscellaneous Operations
+ misc_controller = MiscController(options)
+ mapper.connect("/v1.0/", controller=misc_controller,
+ action="get_version_info",conditions=dict(method=["GET"]))
+ mapper.connect("/v1.0", controller=misc_controller,
+ action="get_version_info",conditions=dict(method=["GET"]))
+
super(Auth_API, self).__init__(mapper)
diff --git a/test/unit/test_identity.py b/test/unit/test_identity.py
index dca50c16..0626181c 100644
--- a/test/unit/test_identity.py
+++ b/test/unit/test_identity.py
@@ -240,7 +240,7 @@ class identity_test(unittest.TestCase):
#Given _a_ to make inherited test cases in an order.
#here to call below method will call as last test case
- def test_a_get_version(self):
+ def test_a_get_version_json(self):
h = httplib2.Http(".cache")
url = URL
resp, content = h.request(url, "GET", body="",
@@ -248,7 +248,7 @@ class identity_test(unittest.TestCase):
self.assertEqual(200, int(resp['status']))
self.assertEqual('application/json', resp['content-type'])
- def test_a_get_version(self):
+ def test_a_get_version_xml(self):
h = httplib2.Http(".cache")
url = URL
resp, content = h.request(url, "GET", body="",