Merge "PXE driver should not accept empty kernel UUID."
This commit is contained in:
commit
5ac99deadc
@ -248,6 +248,13 @@ class PXEClassMethodsTestCase(BareMetalPXETestCase):
|
||||
pxe.get_tftp_image_info,
|
||||
self.instance)
|
||||
|
||||
# Test that other non-true values also raise an exception
|
||||
CONF.baremetal.deploy_kernel = ""
|
||||
CONF.baremetal.deploy_ramdisk = ""
|
||||
self.assertRaises(exception.NovaException,
|
||||
pxe.get_tftp_image_info,
|
||||
self.instance)
|
||||
|
||||
# Even if the instance includes kernel_id and ramdisk_id,
|
||||
# we still need deploy_kernel_id and deploy_ramdisk_id.
|
||||
# If those aren't present in instance[], and not specified in
|
||||
@ -289,6 +296,17 @@ class PXEClassMethodsTestCase(BareMetalPXETestCase):
|
||||
self.assertEqual(res['deploy_kernel'][0], 'eeee')
|
||||
self.assertEqual(res['deploy_ramdisk'][0], 'ffff')
|
||||
|
||||
# However, if invalid values are passed on the image extra_specs,
|
||||
# this should still raise an exception.
|
||||
extra_specs = {
|
||||
'deploy_kernel_id': '',
|
||||
'deploy_ramdisk_id': '',
|
||||
}
|
||||
self.instance['extra_specs'] = extra_specs
|
||||
self.assertRaises(exception.NovaException,
|
||||
pxe.get_tftp_image_info,
|
||||
self.instance)
|
||||
|
||||
|
||||
class PXEPrivateMethodsTestCase(BareMetalPXETestCase):
|
||||
|
||||
|
@ -218,7 +218,7 @@ def get_tftp_image_info(instance):
|
||||
missing_labels = []
|
||||
for label in image_info.keys():
|
||||
(uuid, path) = image_info[label]
|
||||
if uuid is None:
|
||||
if not uuid:
|
||||
missing_labels.append(label)
|
||||
else:
|
||||
image_info[label][1] = os.path.join(CONF.baremetal.tftp_root,
|
||||
|
Loading…
x
Reference in New Issue
Block a user