From 5b7b2c280d852a8455b3c8e76c06d409c2e4dd54 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Tue, 17 Sep 2013 17:56:27 +0200 Subject: [PATCH] When UserDataPlugin doesn't find the user_data file, it has to throw NotExistingMetadataException --- cloudbaseinit/metadata/services/configdrive/configdrive.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cloudbaseinit/metadata/services/configdrive/configdrive.py b/cloudbaseinit/metadata/services/configdrive/configdrive.py index 012678f9..c2d67d6c 100644 --- a/cloudbaseinit/metadata/services/configdrive/configdrive.py +++ b/cloudbaseinit/metadata/services/configdrive/configdrive.py @@ -59,8 +59,11 @@ class ConfigDriveService(base.BaseMetadataService): def _get_data(self, path): norm_path = os.path.normpath(os.path.join(self._metadata_path, path)) - with open(norm_path, 'rb') as f: - return f.read() + try: + with open(norm_path, 'rb') as f: + return f.read() + except IOError: + raise base.NotExistingMetadataException() def cleanup(self): if self._metadata_path: