Wait for Couchbase to be ready before node-init
Changes: * Make install_if_needed consistent with MongoDB * Don't run node-init as part of install_if_needed * Start Couchbase and poll until ready before node-init Closes-Bug: #1325753 Change-Id: I1bbb616b6ec2eb6b83faa30f597a6331421542fb
This commit is contained in:
parent
d4ba64dfe2
commit
e634d471d2
|
@ -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.'))
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue