Update pep and sphinx
This commit is contained in:
parent
4f545c0afd
commit
5eeddfc1d1
|
@ -28,7 +28,9 @@ cfg.CONF.register_opts([
|
|||
help='Name of this node'),
|
||||
cfg.StrOpt('control-exchange', default='billistix',
|
||||
help='AMQP exchange to connect to if using RabbitMQ or Qpid'),
|
||||
cfg.StrOpt('central-topic', default='billing_central', help='Central Topic'),
|
||||
cfg.StrOpt('central-topic',
|
||||
default='billing_central',
|
||||
help='Central Topic'),
|
||||
cfg.StrOpt('worker-topic', default='billing_worker', help='Worker Topic'),
|
||||
cfg.StrOpt('state-path', default='$pybasedir', help='State Path')
|
||||
])
|
||||
|
|
|
@ -50,4 +50,3 @@ class KeystoneContextMiddleware(wsgi.Middleware):
|
|||
class NoAuthMiddleware(wsgi.Middleware):
|
||||
def process_request(self, request):
|
||||
request.environ['context'] = RequestContext()
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class Service(wsgi.Service):
|
|||
config_path = utils.find_config(config_path)
|
||||
|
||||
self.application = deploy.loadapp("config:%s" % config_path,
|
||||
name='osapi_billing')
|
||||
name='osapi_billing')
|
||||
|
||||
def start(self):
|
||||
return super(Service, self).start(application=self.application,
|
||||
|
|
|
@ -13,4 +13,3 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ class RecorderEngine(object):
|
|||
"customer_system_id": "c97027dd880d4c129ae7a4ba7edade05"
|
||||
}
|
||||
|
||||
resource_id: The ID of the resource that's billed (External ID typically)
|
||||
resource_id: The ID of the resource that's billed
|
||||
(External ID typically)
|
||||
type: The type, application, instance, network etc
|
||||
volume: The volume that's currently pulled
|
||||
metadata: JSON
|
||||
|
|
|
@ -100,7 +100,9 @@ class RecordEngine(OpenstackEngine):
|
|||
type_ = 'port'
|
||||
metadata['network_id'] = resource['metadata'].get('network_id')
|
||||
metadata['mac'] = resource['metadata'].get('mac_address')
|
||||
metadata['ips'] = ','.join([item['ip_address'] \
|
||||
for item in resource['metadata'].get('fixed_ips', []) \
|
||||
if 'ip_address' in item])
|
||||
ips = []
|
||||
for item in resource['metadata'].get('fixed_ips', []):
|
||||
if 'ip_address' in item:
|
||||
ips.append(item['ip_address'])
|
||||
metadata['ips'] = ','.join(ips)
|
||||
return type_, volume, metadata
|
||||
|
|
|
@ -28,8 +28,8 @@ LOG = log.getLogger(__name__)
|
|||
|
||||
cfg.CONF.register_opts([
|
||||
cfg.IntOpt('periodic_interval',
|
||||
default=1,
|
||||
help='seconds between running periodic tasks'),
|
||||
default=1,
|
||||
help='seconds between running periodic tasks'),
|
||||
])
|
||||
|
||||
CLI_OPTIONS = [
|
||||
|
@ -69,7 +69,7 @@ class Service(rpc_service.Service):
|
|||
def start(self):
|
||||
task = LoopingCall(self.poll_records)
|
||||
task.start(interval=cfg.CONF.periodic_interval,
|
||||
initial_delay=cfg.CONF.periodic_interval)
|
||||
initial_delay=cfg.CONF.periodic_interval)
|
||||
self.timers.append(task)
|
||||
super(Service, self).start()
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ DRIVER_NAMESPACE = 'billistix.storage'
|
|||
|
||||
cfg.CONF.register_opts([
|
||||
cfg.StrOpt('database_connection',
|
||||
default='sqlite:///$state_path/billistix.db',
|
||||
help='The database driver to use'),
|
||||
default='sqlite:///$state_path/billistix.db',
|
||||
help='The database driver to use'),
|
||||
])
|
||||
|
||||
|
||||
|
@ -40,10 +40,10 @@ def register_opts(conf):
|
|||
def get_engine(conf):
|
||||
engine_name = urlparse(conf.database_connection).scheme
|
||||
LOG.debug('looking for %r engine in %r',
|
||||
engine_name, DRIVER_NAMESPACE)
|
||||
engine_name, DRIVER_NAMESPACE)
|
||||
mgr = driver.DriverManager(DRIVER_NAMESPACE,
|
||||
engine_name,
|
||||
invoke_on_load=True)
|
||||
engine_name,
|
||||
invoke_on_load=True)
|
||||
return mgr.driver
|
||||
|
||||
|
||||
|
@ -58,6 +58,7 @@ def setup_schema():
|
|||
connection = get_connection(cfg.CONF)
|
||||
connection.setup_schema()
|
||||
|
||||
|
||||
def teardown_schema():
|
||||
""" Reset the DB to default - Used for testing purposes """
|
||||
connection = get_connection(cfg.CONF)
|
||||
|
|
|
@ -36,6 +36,7 @@ class StorageEngine(object):
|
|||
Return a Connection instance based on the configuration settings.
|
||||
"""
|
||||
|
||||
|
||||
class Connection(object):
|
||||
"""
|
||||
A Connection
|
||||
|
|
|
@ -152,7 +152,9 @@ class Record(Base):
|
|||
end_timestamp = Column(DateTime)
|
||||
|
||||
customer_system = relationship("CustomerSystem", backref="records")
|
||||
customer_system_id = Column(Unicode(100), ForeignKey('customer_systems.system_id'), nullable=False)
|
||||
customer_system_id = Column(Unicode(100),
|
||||
ForeignKey('customer_systems.system_id'),
|
||||
nullable=False)
|
||||
|
||||
|
||||
class Rate(Base):
|
||||
|
|
|
@ -19,7 +19,7 @@ import unittest
|
|||
import mox
|
||||
from billistix.openstack.common import cfg
|
||||
from billistix.openstack.common import log as logging
|
||||
from billistix.openstack.common.context import RequestContext, get_admin_context
|
||||
from billistix.openstack.common import context
|
||||
from billistix import storage
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -48,10 +48,10 @@ class TestCase(unittest.TestCase):
|
|||
cfg.CONF.set_override(k, v, group)
|
||||
|
||||
def get_context(self, **kwargs):
|
||||
return RequestContext(**kwargs)
|
||||
return context.RequestContext(**kwargs)
|
||||
|
||||
def get_admin_context(self):
|
||||
return get_admin_context()
|
||||
return context.get_admin_context()
|
||||
|
||||
|
||||
if sys.version_info < (2, 7):
|
||||
|
|
|
@ -22,4 +22,3 @@ class CentralTestCase(TestCase):
|
|||
|
||||
def get_central_service(self):
|
||||
return central_service.Service()
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ class StorageDriverTestCase(StorageTestCase):
|
|||
__test__ = False
|
||||
|
||||
rate_fixtures = [
|
||||
{'name': 'cpu', 'value': 1},
|
||||
{'name': 'memory', 'value': 2}
|
||||
{'name': 'cpu', 'value': 1},
|
||||
{'name': 'memory', 'value': 2}
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -72,8 +72,8 @@ class StorageDriverTestCase(StorageTestCase):
|
|||
self.admin_context,
|
||||
{'name': 'cpu', 'value': 1})
|
||||
self.storage_conn.update_rate(
|
||||
self.admin_context,
|
||||
rate.id,
|
||||
values={'name': 'memory', 'value': 15})
|
||||
self.admin_context,
|
||||
rate.id,
|
||||
values={'name': 'memory', 'value': 15})
|
||||
self.assertEquals(rate.name, 'memory')
|
||||
self.assertEquals(rate.value, 15)
|
||||
|
|
|
@ -25,4 +25,3 @@ class Middleware(wsgi.Middleware):
|
|||
return cls(app, **local_conf)
|
||||
|
||||
return _factory
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import os
|
||||
import sys
|
||||
import eventlet
|
||||
from billistix.openstack.common import cfg
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import eventlet
|
||||
from billistix.openstack.common import cfg
|
||||
|
|
|
@ -14,8 +14,9 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import eventlet
|
||||
import os
|
||||
import sys
|
||||
import eventlet
|
||||
|
||||
from billistix.openstack.common import cfg
|
||||
from billistix.openstack.common import log
|
||||
|
|
Loading…
Reference in New Issue