diff --git a/cloudbaseinit/plugins/windows/networkconfig.py b/cloudbaseinit/plugins/windows/networkconfig.py index 250d5296..2f120970 100644 --- a/cloudbaseinit/plugins/windows/networkconfig.py +++ b/cloudbaseinit/plugins/windows/networkconfig.py @@ -37,10 +37,11 @@ class NetworkConfigPlugin(base.BasePlugin): def execute(self, service): meta_data = service.get_meta_data('openstack') if 'network_config' not in meta_data: - return False + return (base.PLUGIN_EXECUTION_DONE, False) + network_config = meta_data['network_config'] if 'content_path' not in network_config: - return False + return (base.PLUGIN_EXECUTION_DONE, False) content_path = network_config['content_path'] content_name = content_path.rsplit('/', 1)[-1] diff --git a/cloudbaseinit/plugins/windows/sethostname.py b/cloudbaseinit/plugins/windows/sethostname.py index f42e4c07..3473d432 100644 --- a/cloudbaseinit/plugins/windows/sethostname.py +++ b/cloudbaseinit/plugins/windows/sethostname.py @@ -26,7 +26,7 @@ class SetHostNamePlugin(base.BasePlugin): meta_data = service.get_meta_data('openstack') if 'hostname' not in meta_data: LOG.debug('Hostname not found in metadata') - return False + return (base.PLUGIN_EXECUTION_DONE, False) osutils = osutils_factory.OSUtilsFactory().get_os_utils() diff --git a/cloudbaseinit/plugins/windows/sshpublickeys.py b/cloudbaseinit/plugins/windows/sshpublickeys.py index 58a48810..bff5d68d 100644 --- a/cloudbaseinit/plugins/windows/sshpublickeys.py +++ b/cloudbaseinit/plugins/windows/sshpublickeys.py @@ -29,7 +29,7 @@ class SetUserSSHPublicKeysPlugin(base.BasePlugin): def execute(self, service): meta_data = service.get_meta_data('openstack') if not 'public_keys' in meta_data: - return False + return (base.PLUGIN_EXECUTION_DONE, False) username = CONF.username diff --git a/cloudbaseinit/plugins/windows/userdata.py b/cloudbaseinit/plugins/windows/userdata.py index 5c7ac249..b85850ef 100644 --- a/cloudbaseinit/plugins/windows/userdata.py +++ b/cloudbaseinit/plugins/windows/userdata.py @@ -19,6 +19,7 @@ import re import tempfile import uuid +from cloudbaseinit.metadata.services import base as metadata_services_base from cloudbaseinit.openstack.common import log as logging from cloudbaseinit.osutils import factory as osutils_factory from cloudbaseinit.plugins import base @@ -28,9 +29,13 @@ LOG = logging.getLogger(__name__) class UserDataPlugin(base.BasePlugin): def execute(self, service): - user_data = service.get_user_data('openstack') + try: + user_data = service.get_user_data('openstack') + except metadata_services_base.NotExistingMetadataException: + return (base.PLUGIN_EXECUTION_DONE, False) + if not user_data: - return False + return (base.PLUGIN_EXECUTION_DONE, False) LOG.debug('User data content:\n%s' % user_data) @@ -53,7 +58,7 @@ class UserDataPlugin(base.BasePlugin): else: # Unsupported LOG.warning('Unsupported user_data format') - return False + return (base.PLUGIN_EXECUTION_DONE, False) try: with open(target_path, 'wb') as f: