summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/common/test_pxe_utils.py
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-04-21 06:31:46 +0000
committerGerrit Code Review <review@openstack.org>2021-04-21 06:31:46 +0000
commitf1b87e82d0328a5750258879b680c930c944faf0 (patch)
tree76e9e5d5ffc3d51843ea06cb69e59060c9fb4b91 /ironic/tests/unit/common/test_pxe_utils.py
parent5cbf14fee0dc17f61106e024f7d9574e528a7383 (diff)
parent38f2d1aa03a230f41122cc1656c6060907467ff8 (diff)
downloadironic-f1b87e82d0328a5750258879b680c930c944faf0.tar.gz
Merge "update grub2 file name" into stable/train
Diffstat (limited to 'ironic/tests/unit/common/test_pxe_utils.py')
-rw-r--r--ironic/tests/unit/common/test_pxe_utils.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/ironic/tests/unit/common/test_pxe_utils.py b/ironic/tests/unit/common/test_pxe_utils.py
index 8aad8cd80..e934e2051 100644
--- a/ironic/tests/unit/common/test_pxe_utils.py
+++ b/ironic/tests/unit/common/test_pxe_utils.py
@@ -248,16 +248,22 @@ class TestPXEUtils(db_base.DbTestCase):
mock.call(u'../1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
'/tftpboot/pxelinux.cfg/01-11-22-33-44-55-66'),
mock.call(u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
+ '/tftpboot/grub.cfg-01-11-22-33-44-55-66'),
+ mock.call(u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
'/tftpboot/11:22:33:44:55:66.conf'),
mock.call(u'../1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
'/tftpboot/pxelinux.cfg/01-11-22-33-44-55-67'),
mock.call(u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
+ '/tftpboot/grub.cfg-01-11-22-33-44-55-67'),
+ mock.call(u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
'/tftpboot/11:22:33:44:55:67.conf')
]
unlink_calls = [
mock.call('/tftpboot/pxelinux.cfg/01-11-22-33-44-55-66'),
+ mock.call('/tftpboot/grub.cfg-01-11-22-33-44-55-66'),
mock.call('/tftpboot/11:22:33:44:55:66.conf'),
mock.call('/tftpboot/pxelinux.cfg/01-11-22-33-44-55-67'),
+ mock.call('/tftpboot/grub.cfg-01-11-22-33-44-55-67'),
mock.call('/tftpboot/11:22:33:44:55:67.conf')
]
with task_manager.acquire(self.context, self.node.uuid) as task:
@@ -287,16 +293,22 @@ class TestPXEUtils(db_base.DbTestCase):
mock.call(u'../1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
'/tftpboot/pxelinux.cfg/20-11-22-33-44-55-66'),
mock.call(u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
+ '/tftpboot/grub.cfg-01-11-22-33-44-55-66'),
+ mock.call(u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
'/tftpboot/11:22:33:44:55:66.conf'),
mock.call(u'../1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
'/tftpboot/pxelinux.cfg/20-11-22-33-44-55-67'),
mock.call(u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
+ '/tftpboot/grub.cfg-01-11-22-33-44-55-67'),
+ mock.call(u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
'/tftpboot/11:22:33:44:55:67.conf')
]
unlink_calls = [
mock.call('/tftpboot/pxelinux.cfg/20-11-22-33-44-55-66'),
+ mock.call('/tftpboot/grub.cfg-01-11-22-33-44-55-66'),
mock.call('/tftpboot/11:22:33:44:55:66.conf'),
mock.call('/tftpboot/pxelinux.cfg/20-11-22-33-44-55-67'),
+ mock.call('/tftpboot/grub.cfg-01-11-22-33-44-55-67'),
mock.call('/tftpboot/11:22:33:44:55:67.conf')
]
with task_manager.acquire(self.context, self.node.uuid) as task:
@@ -320,16 +332,22 @@ class TestPXEUtils(db_base.DbTestCase):
mock.call(u'../1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
'/httpboot/pxelinux.cfg/11-22-33-44-55-66'),
mock.call(u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
+ '/httpboot/grub.cfg-01-11-22-33-44-55-66'),
+ mock.call(u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
'/httpboot/11:22:33:44:55:66.conf'),
mock.call(u'../1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
'/httpboot/pxelinux.cfg/11-22-33-44-55-67'),
mock.call(u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
+ '/httpboot/grub.cfg-01-11-22-33-44-55-67'),
+ mock.call(u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123/config',
'/httpboot/11:22:33:44:55:67.conf')
]
unlink_calls = [
mock.call('/httpboot/pxelinux.cfg/11-22-33-44-55-66'),
+ mock.call('/httpboot/grub.cfg-01-11-22-33-44-55-66'),
mock.call('/httpboot/11:22:33:44:55:66.conf'),
mock.call('/httpboot/pxelinux.cfg/11-22-33-44-55-67'),
+ mock.call('/httpboot/grub.cfg-01-11-22-33-44-55-67'),
mock.call('/httpboot/11:22:33:44:55:67.conf'),
]
with task_manager.acquire(self.context, self.node.uuid) as task:
@@ -565,6 +583,7 @@ class TestPXEUtils(db_base.DbTestCase):
ensure_calls = [
mock.call("/tftpboot/pxelinux.cfg/01-%s"
% address.replace(':', '-')),
+ mock.call("/tftpboot/grub.cfg-01-aa-aa-aa-aa-aa-aa"),
mock.call("/tftpboot/%s.conf" % address)
]
@@ -863,6 +882,7 @@ class TestPXEUtils(db_base.DbTestCase):
unlink_calls = [
mock.call('/tftpboot/10.10.0.1.conf'),
mock.call('/tftpboot/pxelinux.cfg/01-aa-aa-aa-aa-aa-aa'),
+ mock.call('/tftpboot/grub.cfg-01-aa-aa-aa-aa-aa-aa'),
mock.call('/tftpboot/' + address + '.conf')
]
unlink_mock.assert_has_calls(unlink_calls)
@@ -891,6 +911,7 @@ class TestPXEUtils(db_base.DbTestCase):
mock.call('/tftpboot/10.10.0.1.conf'),
mock.call('/tftpboot/pxelinux.cfg/01-%s' %
address.replace(':', '-')),
+ mock.call('/tftpboot/grub.cfg-01-aa-aa-aa-aa-aa-aa'),
mock.call('/tftpboot/' + address + '.conf')
]
@@ -919,6 +940,7 @@ class TestPXEUtils(db_base.DbTestCase):
unlink_calls = [
mock.call('/tftpboot/10.10.0.1.conf'),
mock.call('/tftpboot/pxelinux.cfg/01-aa-aa-aa-aa-aa-aa'),
+ mock.call('/tftpboot/grub.cfg-01-aa-aa-aa-aa-aa-aa'),
mock.call('/tftpboot/' + address + ".conf")
]
unlink_mock.assert_has_calls(unlink_calls)
@@ -941,6 +963,7 @@ class TestPXEUtils(db_base.DbTestCase):
ensure_calls = [
mock.call("/httpboot/pxelinux.cfg/%s"
% address.replace(':', '-')),
+ mock.call('/httpboot/grub.cfg-01-aa-aa-aa-aa-aa-aa'),
mock.call("/httpboot/%s.conf" % address)
]
@@ -991,12 +1014,21 @@ class TestPXEUtils(db_base.DbTestCase):
unlink_calls = [
mock.call('/tftpboot/pxelinux.cfg/01-%s' %
address.replace(':', '-')),
+ mock.call('/tftpboot/grub.cfg-01-aa-aa-aa-aa-aa-aa'),
mock.call('/tftpboot/aa:aa:aa:aa:aa:aa.conf')
]
unlink_mock.assert_has_calls(unlink_calls)
rmtree_mock.assert_called_once_with(
os.path.join(CONF.pxe.tftp_root, self.node.uuid))
+ def test__get_pxe_grub_mac_path(self):
+ self.config(tftp_root='/tftpboot-path/', group='pxe')
+ address = "aa:aa:aa:aa:aa:aa"
+ actual = pxe_utils._get_pxe_grub_mac_path(address)
+ self.assertEqual('/tftpboot-path/grub.cfg-01-aa-aa-aa-aa-aa-aa',
+ next(actual))
+ self.assertEqual('/tftpboot-path/' + address + '.conf', next(actual))
+
@mock.patch.object(ipxe.iPXEBoot, '__init__', lambda self: None)
@mock.patch.object(pxe.PXEBoot, '__init__', lambda self: None)