Fix agent PXE template

This regressed when the iLO/agent code landed. This commit:
* Fixes the template
* Adds a test for the agent PXE template
* Removes unused parameter ipa-advertise-url from the template

Change-Id: I41a0189ce5d14e1f1e6b7be9872d029e157fe3c2
This commit is contained in:
Jim Rollenhagen 2014-09-08 11:42:07 -07:00
parent d654f673cf
commit 06fe92afd4
3 changed files with 23 additions and 3 deletions

View File

@ -2,4 +2,4 @@ default deploy
label deploy
kernel {{ pxe_options.deployment_aki_path }}
append initrd={{ pxe_options.deployment_ari_path }} text {{ pxe_options.pxe_append_params }} {% if pxe_options.ipa-api-url %}ipa-api-url={{ pxe_options.ipa-api-url }}{% endif %} {% if pxe_options.ipa-advertise-host %}ipa-advertise-host={{ pxe_options.ipa-advertise-host }}{% endif %}
append initrd={{ pxe_options.deployment_ari_path }} text {{ pxe_options.pxe_append_params }} {% if pxe_options['ipa-api-url'] %}ipa-api-url={{ pxe_options['ipa-api-url'] }}{% endif %}

View File

@ -1,5 +1,5 @@
default deploy
label deploy
kernel {{ pxe_options.deployment_aki_path }}
append initrd={{ pxe_options.deployment_ari_path }} text root=squashfs: {% if pxe_options.pxe_append_params %}{{ pxe_options.pxe_append_params }}{% endif %} state=tmpfs: ipa-api-url={{ pxe_options.ipa-api-url }} {% if pxe_options.ipa-advertise-host %}ipa-advertise-host={{ pxe_options.ipa-advertise-host }}{% endif %}
kernel /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/deploy_kernel
append initrd=/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/deploy_ramdisk text test_param ipa-api-url=http://192.168.122.184:6385

View File

@ -55,6 +55,16 @@ class TestPXEUtils(db_base.DbTestCase):
u'c02d7f33c123/deploy_kernel',
'disk': 'cciss/c0d0,sda,hda,vda'
}
self.agent_pxe_options = {
'deployment_ari_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7'
u'f33c123/deploy_ramdisk',
'pxe_append_params': 'test_param',
'aki_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/'
u'kernel',
'ipa-api-url': 'http://192.168.122.184:6385',
'deployment_aki_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-'
u'c02d7f33c123/deploy_kernel',
}
self.node = object_utils.create_test_node(self.context)
def test__build_pxe_config(self):
@ -67,6 +77,16 @@ class TestPXEUtils(db_base.DbTestCase):
self.assertEqual(rendered_template, unicode(expected_template))
def test__build_pxe_config_with_agent(self):
rendered_template = pxe_utils._build_pxe_config(
self.agent_pxe_options, CONF.agent.agent_pxe_config_template)
expected_template = open(
'ironic/tests/drivers/agent_pxe_config.template').read().rstrip()
self.assertEqual(unicode(expected_template), rendered_template)
@mock.patch('ironic.common.utils.create_link_without_raise')
@mock.patch('ironic.common.utils.unlink_without_raise')
@mock.patch('ironic.drivers.utils.get_node_mac_addresses')