dist upgrade before series upgrade
This commit is contained in:
@@ -166,6 +166,17 @@ class TestGenericUtils(ut_utils.BaseTestCase):
|
||||
_yaml_dict)
|
||||
self._open.assert_called_once_with(_filename, "r")
|
||||
|
||||
def test_dist_upgrade(self):
|
||||
_unit = "app/2"
|
||||
generic_utils.dist_upgrade(_unit)
|
||||
dist_upgrade_cmd = (
|
||||
"""sudo DEBIAN_FRONTEND=noninteractive apt --assume-yes """
|
||||
"""-o "Dpkg::Options::=--force-confdef" """
|
||||
"""-o "Dpkg::Options::=--force-confold" dist-upgrade""")
|
||||
self.model.run_on_unit.assert_has_calls([
|
||||
mock.call(_unit, 'sudo apt update'),
|
||||
mock.call(_unit, dist_upgrade_cmd)])
|
||||
|
||||
def test_do_release_upgrade(self):
|
||||
_unit = "app/2"
|
||||
generic_utils.do_release_upgrade(_unit)
|
||||
|
||||
@@ -374,6 +374,7 @@ def series_upgrade(unit_name, machine_num,
|
||||
model.block_until_unit_wl_status(unit_name, "blocked")
|
||||
logging.info("Waiting for model idleness")
|
||||
model.block_until_all_units_idle()
|
||||
dist_upgrade(unit_name)
|
||||
wrap_do_release_upgrade(unit_name, from_series=from_series,
|
||||
to_series=to_series, files=files,
|
||||
workaround_script=workaround_script)
|
||||
@@ -481,6 +482,26 @@ def run_via_ssh(unit_name, cmd):
|
||||
logging.warn(e)
|
||||
|
||||
|
||||
def dist_upgrade(unit_name):
|
||||
"""Run dist-upgrade on unit after update package db.
|
||||
|
||||
:param unit_name: Unit Name
|
||||
:type unit_name: str
|
||||
:returns: None
|
||||
:rtype: None
|
||||
"""
|
||||
logging.info('Updating package db ' + unit_name)
|
||||
update_cmd = 'sudo apt update'
|
||||
model.run_on_unit(unit_name, update_cmd)
|
||||
|
||||
logging.info('Updating existing packages ' + unit_name)
|
||||
dist_upgrade_cmd = (
|
||||
"""sudo DEBIAN_FRONTEND=noninteractive apt --assume-yes """
|
||||
"""-o "Dpkg::Options::=--force-confdef" """
|
||||
"""-o "Dpkg::Options::=--force-confold" dist-upgrade""")
|
||||
model.run_on_unit(unit_name, dist_upgrade_cmd)
|
||||
|
||||
|
||||
def do_release_upgrade(unit_name):
|
||||
"""Run do-release-upgrade noninteractive.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user