Fix reboot command

Change-Id: Ie7598a69f336618a6daab66f3854d9ebcebe5b3a
Closes-Bug: #1836736
This commit is contained in:
Ilya Shakhat 2019-07-19 16:22:58 +02:00
parent 2df8d325f8
commit ab0930ec6c
2 changed files with 9 additions and 3 deletions

View File

@ -137,8 +137,13 @@ class NodeCollection(utils.ReprMixin):
""" """
LOG.info('Reboot nodes: %s', self) LOG.info('Reboot nodes: %s', self)
task = {'command': 'reboot now'} task = {
self.cloud_management.execute_on_cloud(self.hosts, task) 'command': 'reboot now',
'become': 'yes',
}
# note that all errors are ignored
self.cloud_management.execute_on_cloud(self.hosts, task,
raise_on_error=False)
@public @public
def poweroff(self): def poweroff(self):

View File

@ -193,7 +193,8 @@ class NodeCollectionTestCase(test.TestCase):
def test_reboot(self): def test_reboot(self):
self.node_collection.reboot() self.node_collection.reboot()
self.mock_cloud_management.execute_on_cloud.assert_called_once_with( self.mock_cloud_management.execute_on_cloud.assert_called_once_with(
self.hosts, {'command': 'reboot now'}) self.hosts, {'command': 'reboot now', 'become': 'yes'},
raise_on_error=False)
def test_snapshot(self): def test_snapshot(self):
self.node_collection.snapshot('foo') self.node_collection.snapshot('foo')