Commit 77139a38 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Remove unused imports from APIServer.py

parent 2796e921
#!/usr/bin/env python #!/usr/bin/env python
import inspect # from optparse import OptionParser
import re
import sys
from optparse import OptionParser, OptionValueError
import string
import sqlite3
import os
import json import json
import uuid import uuid
from snfOCCI.registry import snfRegistry from snfOCCI.registry import snfRegistry
from snfOCCI.compute import ComputeBackend, SNFBackend from snfOCCI.compute import ComputeBackend, SNFBackend
from snfOCCI.config import SERVER_CONFIG, KAMAKI_CONFIG, VOMS_CONFIG, KEYSTONE_URL from snfOCCI.config import (
SERVER_CONFIG, KAMAKI_CONFIG, VOMS_CONFIG, KEYSTONE_URL)
from snfOCCI import snf_voms from snfOCCI import snf_voms
from snfOCCI.network import NetworkBackend, IpNetworkBackend, IpNetworkInterfaceBackend, NetworkInterfaceBackend from snfOCCI.network import (
NetworkBackend, IpNetworkBackend, IpNetworkInterfaceBackend,
NetworkInterfaceBackend)
from kamaki.clients.cyclades import CycladesNetworkClient from kamaki.clients.cyclades import CycladesNetworkClient
from snfOCCI.extensions import snf_addons from snfOCCI.extensions import snf_addons
# from kamaki.clients.compute import ComputeClient # from kamaki.clients.compute import ComputeClient
from kamaki.clients.cyclades import CycladesComputeClient as ComputeClient from kamaki.clients.cyclades import CycladesComputeClient as ComputeClient
from kamaki.clients.cyclades import CycladesClient from kamaki.clients.cyclades import CycladesClient
from kamaki.clients import astakos, utils from kamaki.clients import astakos
from kamaki.clients import ClientError from kamaki.clients import ClientError
from occi.core_model import Mixin, Resource from occi.core_model import Mixin, Resource
from occi.backend import MixinBackend from occi.backend import MixinBackend
from occi.extensions.infrastructure import COMPUTE, START, STOP, SUSPEND, RESTART, RESOURCE_TEMPLATE, OS_TEMPLATE, NETWORK, IPNETWORK, NETWORKINTERFACE,IPNETWORKINTERFACE from occi.extensions.infrastructure import (
COMPUTE, START, STOP, SUSPEND, RESTART, RESOURCE_TEMPLATE, OS_TEMPLATE,
NETWORK, IPNETWORK, NETWORKINTERFACE, IPNETWORKINTERFACE)
from occi import wsgi from occi import wsgi
from occi.exceptions import HTTPError from occi.exceptions import HTTPError
from occi import core_model from occi import core_model
from wsgiref.validate import validator from wsgiref.validate import validator
from webob import Request from webob import Request
from pprint import pprint
# def parse_arguments(args):
# kw = dict(
# usage="%prog [options]",
# description="OCCI interface to synnefo API",
# )
# parser = OptionParser(**kw)
# parser.disable_interspersed_args()
def parse_arguments(args): # parser.add_option(
kw = dict( # "--enable_voms",
usage="%prog [options]", # action="store_true", dest="enable_voms", default=False,
description="OCCI interface to synnefo API", # help="Enable voms authorization")
) # parser.add_option(
parser = OptionParser(**kw) # "--voms_db",
parser.disable_interspersed_args() # action="store", type="string", dest="voms_db",
# help="Path to sqlite database file")
parser.add_option( # (opts, args) = parser.parse_args(args)
"--enable_voms",
action="store_true", dest="enable_voms", default=False,
help="Enable voms authorization")
parser.add_option(
"--voms_db",
action="store", type="string", dest="voms_db",
help="Path to sqlite database file")
(opts, args) = parser.parse_args(args) # if opts.enable_voms and not opts.voms_db:
# print "--voms_db option required"
# parser.print_help()
if opts.enable_voms and not opts.voms_db: # return (opts, args)
print "--voms_db option required"
parser.print_help()
return (opts, args)
class MyAPP(wsgi.Application): class MyAPP(wsgi.Application):
...@@ -70,7 +67,7 @@ class MyAPP(wsgi.Application): ...@@ -70,7 +67,7 @@ class MyAPP(wsgi.Application):
"""Initialization of the WSGI OCCI application for synnefo""" """Initialization of the WSGI OCCI application for synnefo"""
global ENABLE_VOMS, VOMS_DB global ENABLE_VOMS, VOMS_DB
ENABLE_VOMS = VOMS_CONFIG['enable_voms'] ENABLE_VOMS = VOMS_CONFIG['enable_voms']
super(MyAPP,self).__init__(registry=snfRegistry()) super(MyAPP, self).__init__(registry=snfRegistry())
self._register_backends() self._register_backends()
VALIDATOR_APP = validator(self) VALIDATOR_APP = validator(self)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment