From c26ea83ad64d3a312b1f472f00f7e427613cb1f2 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Mon, 20 Feb 2017 17:28:53 +0200 Subject: [PATCH] Initialize service var before the metadata discovery The service variable needs to be initialized before the metadata discovery check, as a plugin might request a reboot after the pre-metadata stage and the service variable will remain uninitialized. Closes-bug: #1666258 Change-Id: I4028b76f787267476b5320e5a480f54b58c59293 --- cloudbaseinit/init.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudbaseinit/init.py b/cloudbaseinit/init.py index 55fe66df..55a6f805 100644 --- a/cloudbaseinit/init.py +++ b/cloudbaseinit/init.py @@ -159,6 +159,7 @@ class InitManager(object): sys.exit(exit_code) def configure_host(self): + service = None osutils = osutils_factory.get_os_utils() if CONF.reset_service_password and sys.platform == 'win32': @@ -183,7 +184,6 @@ class InitManager(object): service = metadata_factory.get_metadata_service() except exception.MetadaNotFoundException: LOG.error("No metadata service found") - service = None if service: LOG.info('Metadata service loaded: \'%s\'' % service.get_name())