From 9e717d67d72b2e53aec9795eb38dcb884886dc11 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Tue, 14 Aug 2018 17:56:56 +0200 Subject: [PATCH] Issue a message to update nodes after updating images Currently it may be confusing for operators that the image upload command does not update nodes when uploading new versions of images. This change adds a reminder to do so. Change-Id: I834043c559004bbf5eeaf0a611cfa70ff29b7b05 Closes-Bug: #1786970 --- .../tests/v1/overcloud_image/test_overcloud_image.py | 2 ++ tripleoclient/v1/overcloud_image.py | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/tripleoclient/tests/v1/overcloud_image/test_overcloud_image.py b/tripleoclient/tests/v1/overcloud_image/test_overcloud_image.py index 335501ab3..eef97c338 100644 --- a/tripleoclient/tests/v1/overcloud_image/test_overcloud_image.py +++ b/tripleoclient/tests/v1/overcloud_image/test_overcloud_image.py @@ -432,6 +432,7 @@ class TestUploadOvercloudImage(TestPluginV1): ) self.assertEqual(mock_subprocess_call.call_count, 0) + self.assertFalse(self.cmd.updated) @mock.patch('subprocess.check_call', autospec=True) def test_overcloud_create_update_images(self, mock_subprocess_call): @@ -462,6 +463,7 @@ class TestUploadOvercloudImage(TestPluginV1): self.app.client_manager.image.images.update.call_count ) self.assertEqual(mock_subprocess_call.call_count, 2) + self.assertTrue(self.cmd.updated) class TestUploadOvercloudImageFull(TestPluginV1): diff --git a/tripleoclient/v1/overcloud_image.py b/tripleoclient/v1/overcloud_image.py index 6d839b742..dfd156441 100644 --- a/tripleoclient/v1/overcloud_image.py +++ b/tripleoclient/v1/overcloud_image.py @@ -194,6 +194,7 @@ class UploadOvercloudImage(command.Command): '', image.created_at)) ) + self.updated = True return None else: print('Image "%s" already exists and can be updated' @@ -306,6 +307,7 @@ class UploadOvercloudImage(command.Command): def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) glance_client_adaptor = self._get_glance_client_adaptor() + self.updated = False if parsed_args.platform and not parsed_args.architecture: raise exceptions.CommandError('You supplied a platform (%s) ' @@ -493,3 +495,8 @@ class UploadOvercloudImage(command.Command): os.path.join(parsed_args.http_boot, 'agent.ramdisk'), parsed_args.update_existing ) + + if self.updated: + print('Some images have been updated in Glance, make sure to ' + 'rerun\n\topenstack overcloud node configure\nto reflect ' + 'the changes on the nodes')