Reorganize package structure around new product name (libra). Make tests directory NOT be a Python package. Rename executables. Add common source dir.
This commit is contained in:
parent
b15f2b4107
commit
81ac6a1fa1
6
README
6
README
@ -36,13 +36,13 @@ mode (-d option) is useful for testing.
|
|||||||
Basic commands:
|
Basic commands:
|
||||||
|
|
||||||
# Getting help
|
# Getting help
|
||||||
$ lbaas_worker -h
|
$ libra_worker -h
|
||||||
|
|
||||||
# Start up as a daemon
|
# Start up as a daemon
|
||||||
$ sudo lbaas_worker
|
$ sudo libra_worker
|
||||||
|
|
||||||
# Start up with debugging output in non-daemon mode
|
# Start up with debugging output in non-daemon mode
|
||||||
$ lbaas_worker --debug -d
|
$ libra_worker --debug -d
|
||||||
|
|
||||||
You can verify that the worker is running by using the sample Gearman
|
You can verify that the worker is running by using the sample Gearman
|
||||||
client in the bin/ directory:
|
client in the bin/ directory:
|
||||||
|
13
libra/common/__init__.py
Normal file
13
libra/common/__init__.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Copyright 2012 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
@ -17,7 +17,7 @@ import json
|
|||||||
import socket
|
import socket
|
||||||
|
|
||||||
from json_gearman import JSONGearmanWorker
|
from json_gearman import JSONGearmanWorker
|
||||||
from lbaas_mgm.faults import BadRequest
|
from libra.mgm.faults import BadRequest
|
||||||
|
|
||||||
|
|
||||||
class Listener(object):
|
class Listener(object):
|
@ -19,7 +19,7 @@ import daemon
|
|||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from lbaas_mgm.listener import Listener
|
from libra.mgm.listener import Listener
|
||||||
|
|
||||||
|
|
||||||
class Server(object):
|
class Server(object):
|
13
libra/worker/__init__.py
Normal file
13
libra/worker/__init__.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Copyright 2012 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
@ -21,8 +21,8 @@ import logging
|
|||||||
import socket
|
import socket
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from lbaas_worker.json_gearman import JSONGearmanWorker
|
from libra.worker.json_gearman import JSONGearmanWorker
|
||||||
from lbaas_worker.faults import BadRequest
|
from libra.worker.faults import BadRequest
|
||||||
|
|
||||||
|
|
||||||
def lbaas_task(worker, job):
|
def lbaas_task(worker, job):
|
6
setup.py
6
setup.py
@ -45,7 +45,7 @@ except Exception:
|
|||||||
ci_cmdclass['test'] = PyTest
|
ci_cmdclass['test'] = PyTest
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="lbaas_devices",
|
name="libra",
|
||||||
description="Python LBaaS Gearman Worker and Pool Manager",
|
description="Python LBaaS Gearman Worker and Pool Manager",
|
||||||
version="1.0",
|
version="1.0",
|
||||||
author="David Shrewsbury <shrewsbury.dave@gmail.com>, \
|
author="David Shrewsbury <shrewsbury.dave@gmail.com>, \
|
||||||
@ -53,8 +53,8 @@ setuptools.setup(
|
|||||||
packages=setuptools.find_packages(exclude=["*.tests"]),
|
packages=setuptools.find_packages(exclude=["*.tests"]),
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
'lbaas_worker = lbaas_worker.worker:main',
|
'libra_worker = libra.worker.worker:main',
|
||||||
'lbaas_pool_mgm = lbaas_mgm.mgm:main'
|
'libra_pool_mgm = libra.mgm.mgm:main'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
cmdclass=ci_cmdclass,
|
cmdclass=ci_cmdclass,
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import tests.mock
|
import mock
|
||||||
|
|
||||||
from lbaas_mgm.listener import Listener
|
from libra.mgm.listener import Listener
|
||||||
|
|
||||||
|
|
||||||
class TestLBaaSMgmTask(unittest.TestCase):
|
class TestLBaaSMgmTask(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.logger = logging.getLogger('lbass_mgm_test')
|
self.logger = logging.getLogger('lbass_mgm_test')
|
||||||
self.lh = tests.mock.MockLoggingHandler()
|
self.lh = mock.MockLoggingHandler()
|
||||||
self.logger.setLevel(logging.DEBUG)
|
self.logger.setLevel(logging.DEBUG)
|
||||||
self.logger.addHandler(self.lh)
|
self.logger.addHandler(self.lh)
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ class TestLBaaSMgmTask(unittest.TestCase):
|
|||||||
def testTaskGet(self):
|
def testTaskGet(self):
|
||||||
listener = Listener(self.logger)
|
listener = Listener(self.logger)
|
||||||
data = {'command': 'get'}
|
data = {'command': 'get'}
|
||||||
job = tests.mock.FakeJob(data)
|
job = mock.FakeJob(data)
|
||||||
result = listener.task(None, job)
|
result = listener.task(None, job)
|
||||||
self.assertIn('Command: get', self.lh.messages['debug'])
|
self.assertIn('Command: get', self.lh.messages['debug'])
|
||||||
self.assertEqual(result['command'], data['command'])
|
self.assertEqual(result['command'], data['command'])
|
||||||
@ -27,7 +27,7 @@ class TestLBaaSMgmTask(unittest.TestCase):
|
|||||||
def testTaskBad(self):
|
def testTaskBad(self):
|
||||||
listener = Listener(self.logger)
|
listener = Listener(self.logger)
|
||||||
data = {'command': 'bad'}
|
data = {'command': 'bad'}
|
||||||
job = tests.mock.FakeJob(data)
|
job = mock.FakeJob(data)
|
||||||
result = listener.task(None, job)
|
result = listener.task(None, job)
|
||||||
self.assertIn("badRequest", result)
|
self.assertIn("badRequest", result)
|
||||||
self.assertIn("validationErrors", result['badRequest'])
|
self.assertIn("validationErrors", result['badRequest'])
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import unittest
|
import unittest
|
||||||
from lbaas_worker.worker import lbaas_task
|
from libra.worker.worker import lbaas_task
|
||||||
|
|
||||||
|
|
||||||
class FakeJob(object):
|
class FakeJob(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user