Add release info to worker DISCOVER message.

Change-Id: Iffa0f79b21ac1f907958d2e5b0d2b58202217248
This commit is contained in:
David Shrewsbury
2013-04-12 10:01:05 -04:00
parent feb1ea2bdc
commit fa17088e4c
3 changed files with 11 additions and 1 deletions

View File

@@ -181,7 +181,11 @@ The DISCOVER message allows a sender (i.e., API server) to discover the version
of a running worker process. The version can then be used to decide which
messages are supported.
A **version** field will be returned in the JSON message.
A **version** field will be returned in the JSON message. It will be in the
format of <major>.<minor>.
A **release** field will also be returned in the JSON message. It contains
more complete versioning information as returned from a 'git describe'.
Required Fields
^^^^^^^^^^^^^^^
@@ -205,6 +209,7 @@ Example Response
{
"hpcs_action": "DISCOVER",
"version": "1.0",
"release": "1.0.alpha.3.gca84083",
"hpcs_response": "PASS"
}

View File

@@ -2,6 +2,7 @@ import logging
import testtools
import libra.tests.mock_objects
from libra import __version__ as libra_version
from libra import __release__ as libra_release
from libra.worker.controller import LBaaSController as c
from libra.worker.drivers.base import LoadBalancerDriver
from libra.worker.drivers.haproxy.driver import HAProxyDriver
@@ -145,8 +146,10 @@ class TestWorkerController(testtools.TestCase):
controller = c(self.logger, self.driver, msg)
response = controller.run()
self.assertIn('version', response)
self.assertIn('release', response)
self.assertEquals(response[c.RESPONSE_FIELD], c.RESPONSE_SUCCESS)
self.assertEquals(response['version'], libra_version)
self.assertEquals(response['release'], libra_release)
def testArchiveMissingMethod(self):
msg = {

View File

@@ -13,6 +13,7 @@
# under the License.
from libra import __version__ as libra_version
from libra import __release__ as libra_release
from libra.common.faults import BadRequest
from libra.worker.drivers.base import LoadBalancerDriver
@@ -85,6 +86,7 @@ class LBaaSController(object):
which can be used to determine which messages are supported.
"""
self.msg['version'] = libra_version
self.msg['release'] = libra_release
self.msg[self.RESPONSE_FIELD] = self.RESPONSE_SUCCESS
return self.msg