fuel_upgrade: run KillSupervisord hook in 5.0.1
Since we didn't backport a supervisor fix to 5.0.1, we should run our hook during upgrading from 5.0.1 too. Change-Id: I7b12cc537cf1e82f21cbac039e3480928cd24873 Implements: upgrade-to-5-1
This commit is contained in:
parent
b5bdd19c2d
commit
fbb63e9538
@ -38,7 +38,7 @@ class KillSupervisordHook(PreUpgradeHookBase):
|
||||
|
||||
#: commands to kill supervisord
|
||||
commands = [
|
||||
'kill -9 `cat /var/run/supervisord.pid`',
|
||||
'kill -9 `cat /var/run/supervisord.pid` || pkill -9 -P 1 supervisord',
|
||||
'rm -f /var/run/supervisord.pid',
|
||||
'pkill -f "docker.*D.*attach.*fuel-core"',
|
||||
'pkill -f "dockerctl.*start.*attach"']
|
||||
@ -46,7 +46,7 @@ class KillSupervisordHook(PreUpgradeHookBase):
|
||||
def check_if_required(self):
|
||||
"""The hack is required if we're going to upgrade from 5.0 to any.
|
||||
"""
|
||||
return self.config.from_version in ('5.0', )
|
||||
return self.config.from_version in ('5.0', '5.0.1')
|
||||
|
||||
def run(self):
|
||||
for command in self.commands:
|
||||
|
@ -214,6 +214,9 @@ class TestKillSupervisordHook(TestPreUpgradeHooksBase):
|
||||
self.hook.config.from_version = '5.0'
|
||||
self.assertTrue(self.hook.check_if_required())
|
||||
|
||||
self.hook.config.from_version = '5.0.1'
|
||||
self.assertTrue(self.hook.check_if_required())
|
||||
|
||||
def test_is_required_returns_false(self):
|
||||
self.hook.config.from_version = '5.1'
|
||||
self.assertFalse(self.hook.check_if_required())
|
||||
@ -225,7 +228,8 @@ class TestKillSupervisordHook(TestPreUpgradeHooksBase):
|
||||
self.hook.run()
|
||||
|
||||
exec_cmd.assert_has_calls([
|
||||
mock.call('kill -9 `cat /var/run/supervisord.pid`'),
|
||||
mock.call('kill -9 `cat /var/run/supervisord.pid` '
|
||||
'|| pkill -9 -P 1 supervisord'),
|
||||
mock.call('rm -f /var/run/supervisord.pid'),
|
||||
mock.call('pkill -f "docker.*D.*attach.*fuel-core"'),
|
||||
mock.call('pkill -f "dockerctl.*start.*attach"')])
|
||||
|
Loading…
Reference in New Issue
Block a user