import os import json import base64 import falcon import chuckbox.log as log _LOG = log.get_logger(__name__) def new_app(randserve): # Where are we? cwd = os.path.realpath(os.getcwd()) src_dir = os.path.join(cwd, 'src') site_dir = os.path.join(src_dir, 'site') # falcon.API instances are callable WSGI apps app = falcon.API() app.add_route('/rand', RandomResource(randserve)) app.add_route('/roller', RollerResource(site_dir)) app.add_route('/roller/{path}', RollerResource(site_dir)) return app class RollerResource(object): def __init__(self, http_path): self.http_path = http_path
from keystoneclient.v2_0.client import Client as KeystoneClient """ Configuration Example --------------------- [auth.openstack.keystone] service_tenant = tenant service_user = user password = password keystone_url = http://127.0.0.1:35357/v2.0 """ _LOG = get_logger(__name__) _CONFIG_KEY = 'auth.openstack.keystone' _CONFIG = ConfigParser() _CONFIG.read("/etc/pyrox/keystone.conf") AUTH_TENANT_ID = 'Auth-Tenant-ID' X_AUTH_TOKEN = 'X-Auth-Token' def _header_is_set(header): return header is not None and len(header.values) >= 1 def keystone_token_validator():