Browse files

EUCA-4007, renamed server package to eucaconsole

  • Loading branch information...
1 parent e716574 commit ba8c25a44cbbda86d96914a8c1b259b84f57c648 @dkavanagh dkavanagh committed Oct 31, 2012
View
44 console/euca-console-server
@@ -11,9 +11,9 @@ import time
import ConfigParser
import tornado.httpserver
import tornado.ioloop
-import server
-from server import api
-from server.configloader import ConfigLoader
+import eucaconsole
+from eucaconsole import api
+from eucaconsole.configloader import ConfigLoader
PIDFILE = "/var/run/eucalyptus-console.pid"
@@ -67,20 +67,20 @@ def cleanpid(signum=None, action=None):
def sessionChecker():
now = time.time()
- idle = server.config.getint('server', 'session.idle.timeout')
- absolute = server.config.getint('server', 'session.abs.timeout')
+ idle = eucaconsole.config.getint('server', 'session.idle.timeout')
+ absolute = eucaconsole.config.getint('server', 'session.abs.timeout')
expired = [];
# collect ids that expired (because we can't modify the dictionary we're iterating through)
- for session_id in server.sessions:
- session = server.sessions[session_id]
+ for session_id in eucaconsole.sessions:
+ session = eucaconsole.sessions[session_id]
if (now - session.session_start) > absolute:
expired.append(session_id)
elif (now - session.session_last_used) > idle:
expired.append(session_id)
# now, actually expire the sessions we flagged
for id in expired:
- server.terminateSession(id, expired=True)
+ eucaconsole.terminateSession(id, expired=True)
def start_console():
@@ -98,21 +98,21 @@ def start_console():
# When staticpath is in the config we will assume that it is
# not a relative path
try:
- webroot = server.config.get('paths', 'staticpath')
+ webroot = eucaconsole.config.get('paths', 'staticpath')
except ConfigParser.Error:
pass
- if server.config.has_option('server', 'cookie.secret'):
- settings['cookie_secret'] = server.config.get('server', 'cookie.secret')
+ if eucaconsole.config.has_option('server', 'cookie.secret'):
+ settings['cookie_secret'] = eucaconsole.config.get('server', 'cookie.secret')
- if server.config.has_option('server', 'sslcert'):
- ssl_settings['certfile'] = server.config.get('server', 'sslcert')
+ if eucaconsole.config.has_option('server', 'sslcert'):
+ ssl_settings['certfile'] = eucaconsole.config.get('server', 'sslcert')
- if server.config.has_option('server', 'sslkey'):
- ssl_settings['keyfile'] = server.config.get('server', 'sslkey')
+ if eucaconsole.config.has_option('server', 'sslkey'):
+ ssl_settings['keyfile'] = eucaconsole.config.get('server', 'sslkey')
- if server.config.has_option('server', 'uiport'):
- server_port = server.config.getint('server', 'uiport')
+ if eucaconsole.config.has_option('server', 'uiport'):
+ server_port = eucaconsole.config.getint('server', 'uiport')
application = tornado.web.Application([
(r"/(favicon\.ico)", tornado.web.StaticFileHandler, {'path': os.path.join(webroot, 'images')}),
@@ -124,12 +124,12 @@ def start_console():
(r"/help/(.*)", tornado.web.StaticFileHandler, {'path': os.path.join(webroot, 'help')}),
(r"/fonts/(.*)", tornado.web.StaticFileHandler, {'path': os.path.join(webroot, 'fonts')}),
(r"/ec2", api.ComputeHandler),
- (r"/checkip", server.CheckIpHandler),
- (r"/(.*)", server.RootHandler),
+ (r"/checkip", eucaconsole.CheckIpHandler),
+ (r"/(.*)", eucaconsole.RootHandler),
], **settings)
if len(ssl_settings.keys()) > 0: # we're using ssl
- server.using_ssl = True
+ eucaconsole.using_ssl = True
httpserver = tornado.httpserver.HTTPServer(application,
ssl_options=ssl_settings)
httpserver.listen(server_port)
@@ -169,9 +169,9 @@ if __name__ == "__main__":
usage()
if config_file:
- server.config = ConfigLoader().getParser(config_file)
+ eucaconsole.config = ConfigLoader().getParser(config_file)
else:
- server.config = ConfigLoader().getParser()
+ eucaconsole.config = ConfigLoader().getParser()
if daemon:
daemonize(start_console)
View
0 console/server/__init__.py → console/eucaconsole/__init__.py
File renamed without changes.
View
20 console/server/api.py → console/eucaconsole/api.py
@@ -3,7 +3,7 @@
import logging
import json
import tornado.web
-import server
+import eucaconsole
import socket
import time
from M2Crypto import RSA
@@ -18,7 +18,7 @@
from .response import ClcError
from .response import Response
-class ComputeHandler(server.BaseHandler):
+class ComputeHandler(eucaconsole.BaseHandler):
def __normalize_instances__(self, instances):
ret = []
@@ -366,12 +366,12 @@ def get(self):
if self.should_use_mock():
self.user_session.clc = MockClcInterface()
else:
- self.user_session.clc = BotoClcInterface(server.config.get('server', 'clchost'),
+ self.user_session.clc = BotoClcInterface(eucaconsole.config.get('server', 'clchost'),
self.user_session.access_key,
self.user_session.secret_key,
self.user_session.session_token)
# could make this conditional, but add caching always for now
- self.user_session.clc = CachingClcInterface(self.user_session.clc, server.config)
+ self.user_session.clc = CachingClcInterface(self.user_session.clc, eucaconsole.config)
self.user_session.session_lifetime_requests += 1
@@ -403,8 +403,8 @@ def get(self):
ret = Response(ret) # wrap all responses in an object for security purposes
data = json.dumps(ret, cls=BotoJsonEncoder, indent=2)
try:
- if(server.config.get('test','apidelay')):
- time.sleep(int(server.config.get('test','apidelay'))/1000.0);
+ if(eucaconsole.config.get('test','apidelay')):
+ time.sleep(int(eucaconsole.config.get('test','apidelay'))/1000.0);
except ConfigParser.NoOptionError:
pass
self.set_header("Content-Type", "application/json;charset=UTF-8")
@@ -435,12 +435,12 @@ def post(self):
if self.should_use_mock():
self.user_session.clc = MockClcInterface()
else:
- self.user_session.clc = BotoClcInterface(server.config.get('server', 'clchost'),
+ self.user_session.clc = BotoClcInterface(eucaconsole.config.get('server', 'clchost'),
self.user_session.access_key,
self.user_session.secret_key,
self.user_session.session_token)
# could make this conditional, but add caching always for now
- self.user_session.clc = CachingClcInterface(self.user_session.clc, server.config)
+ self.user_session.clc = CachingClcInterface(self.user_session.clc, eucaconsole.config)
self.user_session.session_lifetime_requests += 1
@@ -497,8 +497,8 @@ def post(self):
ret = Response(ret) # wrap all responses in an object for security purposes
data = json.dumps(ret, cls=BotoJsonEncoder, indent=2)
try:
- if(server.config.get('test','apidelay')):
- time.sleep(int(server.config.get('test','apidelay'))/1000.0);
+ if(eucaconsole.config.get('test','apidelay')):
+ time.sleep(int(eucaconsole.config.get('test','apidelay'))/1000.0);
except ConfigParser.NoOptionError:
pass
self.set_header("Content-Type", "application/json;charset=UTF-8")
View
0 console/server/botoclcinterface.py → console/eucaconsole/botoclcinterface.py
File renamed without changes.
View
0 console/server/botojsonencoder.py → console/eucaconsole/botojsonencoder.py
File renamed without changes.
View
0 console/server/cachingclcinterface.py → console/eucaconsole/cachingclcinterface.py
File renamed without changes.
View
0 console/server/clcinterface.py → console/eucaconsole/clcinterface.py
File renamed without changes.
View
0 console/server/configloader.py → console/eucaconsole/configloader.py
File renamed without changes.
View
0 console/server/console.ini → console/eucaconsole/console.ini
File renamed without changes.
View
0 console/server/mockclcinterface.py → console/eucaconsole/mockclcinterface.py
File renamed without changes.
View
0 console/server/response.py → console/eucaconsole/response.py
File renamed without changes.
View
6 console/server/token.py → console/eucaconsole/token.py
@@ -8,7 +8,7 @@
import xml.sax
from boto.sts.credentials import Credentials
-import server
+import eucaconsole
class TokenAuthenticator(object):
@@ -39,7 +39,7 @@ def authenticate(self, account, user, passwd):
traceback.print_exc(file=sys.stdout)
if not(issubclass(err.__class__, urllib2.HTTPError)):
if isinstance(err.reason, socket.timeout):
- raise server.EuiException(504, 'Timed out')
- raise server.EuiException(401, 'Not Authorized')
+ raise eucaconsole.EuiException(504, 'Timed out')
+ raise eucaconsole.EuiException(401, 'Not Authorized')
View
2 console/launcher.sh
@@ -2,4 +2,4 @@
export PYTHONPATH=`pwd`
-python -tt euca-console-server -c ./server/console.ini
+python -tt euca-console-server -c ./eucaconsole/console.ini

0 comments on commit ba8c25a

Please sign in to comment.