Do not install NTP when installed in a container
Check if the charm is installed inside a container and do not install NTP if that is the case. Change-Id: I9a9a50e724e24aa0d5b04d544a82b2d8202cd181 Partial-Bug: #169051
This commit is contained in:
parent
59f113d912
commit
e60c420377
@ -40,6 +40,7 @@ from charmhelpers.core.host import (
|
||||
service_start,
|
||||
service_stop,
|
||||
CompareHostReleases,
|
||||
is_container,
|
||||
)
|
||||
from charmhelpers.core.hookenv import (
|
||||
cached,
|
||||
@ -1583,7 +1584,7 @@ def upgrade_monitor(new_version):
|
||||
service_stop('ceph-mon@{}'.format(mon_id))
|
||||
else:
|
||||
service_stop('ceph-mon-all')
|
||||
apt_install(packages=PACKAGES, fatal=True)
|
||||
apt_install(packages=determine_packages(), fatal=True)
|
||||
|
||||
# Ensure the files and directories under /var/lib/ceph is chowned
|
||||
# properly as part of the move to the Jewel release, which moved the
|
||||
@ -1767,7 +1768,7 @@ def upgrade_osd(new_version):
|
||||
try:
|
||||
# Upgrade the packages before restarting the daemons.
|
||||
status_set('maintenance', 'Upgrading packages to %s' % new_version)
|
||||
apt_install(packages=PACKAGES, fatal=True)
|
||||
apt_install(packages=determine_packages(), fatal=True)
|
||||
|
||||
# If the upgrade does not need an ownership update of any of the
|
||||
# directories in the osd service directory, then simply restart
|
||||
@ -2105,3 +2106,14 @@ def reweight_osd(osd_num, new_weight):
|
||||
log("ceph osd tree command failed with message: {}".format(
|
||||
e.message))
|
||||
raise
|
||||
|
||||
|
||||
def determine_packages():
|
||||
'''
|
||||
Determines packages for installation.
|
||||
|
||||
@returns: list of ceph packages
|
||||
'''
|
||||
if is_container():
|
||||
PACKAGES.remove('ntp')
|
||||
return PACKAGES
|
||||
|
@ -322,6 +322,15 @@ class CephTestCase(unittest.TestCase):
|
||||
mock_reweight.assert_called_once_with(
|
||||
['ceph', 'osd', 'crush', 'reweight', 'osd.0', '1'], stderr=-2)
|
||||
|
||||
@mock.patch.object(ceph, 'is_container')
|
||||
def test_determine_packages(self, mock_is_container):
|
||||
mock_is_container.return_value = False
|
||||
self.assertTrue('ntp' in ceph.determine_packages())
|
||||
self.assertEqual(ceph.PACKAGES, ceph.determine_packages())
|
||||
|
||||
mock_is_container.return_value = True
|
||||
self.assertFalse('ntp' in ceph.determine_packages())
|
||||
|
||||
|
||||
class CephVersionTestCase(unittest.TestCase):
|
||||
@mock.patch.object(ceph, 'get_os_codename_install_source')
|
||||
|
Loading…
Reference in New Issue
Block a user