Merge "Wait for Couchbase to be ready before node-init"

This commit is contained in:
Jenkins 2014-06-09 17:14:56 +00:00 committed by Gerrit Code Review
commit c0ef10ec6c
4 changed files with 8 additions and 5 deletions

View File

@ -64,6 +64,7 @@ class Manager(periodic_task.PeriodicTasks):
prepare handles all the base configuration of the Couchbase instance.
"""
self.appStatus.begin_install()
self.app.install_if_needed(packages)
if device_path:
device = volume.VolumeDevice(device_path)
# unmount if device is already mounted
@ -71,10 +72,11 @@ class Manager(periodic_task.PeriodicTasks):
device.format()
device.mount(mount_point)
LOG.debug('Mounted the volume.')
self.app.start_db_with_conf_changes(config_contents)
LOG.info(_('Securing couchbase now.'))
if root_password:
self.app.enable_root(root_password)
self.app.install_if_needed(packages)
LOG.info(_('Securing couchbase now.'))
self.app.initial_setup()
self.app.complete_install_or_restart()
LOG.info(_('"prepare" couchbase call has finished.'))

View File

@ -58,7 +58,6 @@ class CouchbaseApp(object):
if not packager.pkg_is_installed(packages):
LOG.info(_('Installing Couchbase'))
self._install_couchbase(packages)
self.initial_setup()
def initial_setup(self):
self.ip_address = operating_system.get_ip_address()

View File

@ -73,6 +73,10 @@ class GuestAgentCouchbaseManagerTest(testtools.TestCase):
volume.VolumeDevice.mount_points = MagicMock(return_value=[])
couch_service.CouchbaseApp.install_if_needed = MagicMock(
return_value=None)
couch_service.CouchbaseApp.start_db_with_conf_changes = MagicMock(
return_value=None)
couch_service.CouchbaseApp.initial_setup = MagicMock(
return_value=None)
couch_service.CouchbaseApp.complete_install_or_restart = MagicMock(
return_value=None)

View File

@ -1599,13 +1599,11 @@ class CouchbaseAppTest(testtools.TestCase):
self.assertTrue(conductor_api.API.heartbeat.called)
def test_install_when_couchbase_installed(self):
self.couchbaseApp.initial_setup = Mock()
couchservice.packager.pkg_is_installed = Mock(return_value=True)
couchservice.utils.execute_with_timeout = Mock()
self.couchbaseApp.install_if_needed(["package"])
self.assertTrue(couchservice.packager.pkg_is_installed.called)
self.assertTrue(self.couchbaseApp.initial_setup.called)
self.assert_reported_status(rd_instance.ServiceStatuses.NEW)