Merge "Use sh instead of bash when installing grub"

This commit is contained in:
Jenkins 2017-01-18 10:27:56 +00:00 committed by Gerrit Code Review
commit 7680625994
3 changed files with 17 additions and 11 deletions

View File

@ -112,7 +112,7 @@ def _install_grub2(device, root_uuid, efi_system_part_uuid=None):
path_variable = '%s:/bin' % path_variable
# Install grub
utils.execute('chroot %(path)s /bin/bash -c '
utils.execute('chroot %(path)s /bin/sh -c '
'"/usr/sbin/%(bin)s-install %(dev)s"' %
{'path': path, 'bin': binary_name, 'dev': device},
shell=True, env_variables={'PATH': path_variable})
@ -125,13 +125,13 @@ def _install_grub2(device, root_uuid, efi_system_part_uuid=None):
# the default file to be copied, destination file name, and
# prevents NVRAM from being updated.
if efi_partition:
utils.execute('chroot %(path)s /bin/bash -c '
utils.execute('chroot %(path)s /bin/sh -c '
'"/usr/sbin/%(bin)s-install %(dev)s --removable"' %
{'path': path, 'bin': binary_name, 'dev': device},
shell=True, env_variables={'PATH': path_variable})
# Generate the grub configuration file
utils.execute('chroot %(path)s /bin/bash -c '
utils.execute('chroot %(path)s /bin/sh -c '
'"/usr/sbin/%(bin)s-mkconfig -o '
'/boot/%(bin)s/grub.cfg"' %
{'path': path, 'bin': binary_name}, shell=True,

View File

@ -86,11 +86,11 @@ class TestImageExtension(test_base.BaseTestCase):
self.fake_dir + '/proc'),
mock.call('mount', '-t', 'sysfs', 'none',
self.fake_dir + '/sys'),
mock.call(('chroot %s /bin/bash -c '
mock.call(('chroot %s /bin/sh -c '
'"/usr/sbin/grub-install %s"' %
(self.fake_dir, self.fake_dev)), shell=True,
env_variables={'PATH': '/sbin:/bin'}),
mock.call(('chroot %s /bin/bash -c '
mock.call(('chroot %s /bin/sh -c '
'"/usr/sbin/grub-mkconfig -o '
'/boot/grub/grub.cfg"' % self.fake_dir),
shell=True,
@ -131,15 +131,15 @@ class TestImageExtension(test_base.BaseTestCase):
self.fake_dir + '/sys'),
mock.call('mount', self.fake_efi_system_part,
self.fake_dir + '/boot/efi'),
mock.call(('chroot %s /bin/bash -c '
mock.call(('chroot %s /bin/sh -c '
'"/usr/sbin/grub-install %s"' %
(self.fake_dir, self.fake_dev)), shell=True,
env_variables={'PATH': '/sbin:/bin'}),
mock.call(('chroot %s /bin/bash -c '
mock.call(('chroot %s /bin/sh -c '
'"/usr/sbin/grub-install %s --removable"' %
(self.fake_dir, self.fake_dev)), shell=True,
env_variables={'PATH': '/sbin:/bin'}),
mock.call(('chroot %s /bin/bash -c '
mock.call(('chroot %s /bin/sh -c '
'"/usr/sbin/grub-mkconfig -o '
'/boot/grub/grub.cfg"' % self.fake_dir),
shell=True,
@ -191,15 +191,15 @@ class TestImageExtension(test_base.BaseTestCase):
self.fake_dir + '/sys'),
mock.call('mount', self.fake_efi_system_part,
self.fake_dir + '/boot/efi'),
mock.call(('chroot %s /bin/bash -c '
mock.call(('chroot %s /bin/sh -c '
'"/usr/sbin/grub-install %s"' %
(self.fake_dir, self.fake_dev)), shell=True,
env_variables={'PATH': '/sbin:/bin'}),
mock.call(('chroot %s /bin/bash -c '
mock.call(('chroot %s /bin/sh -c '
'"/usr/sbin/grub-install %s --removable"' %
(self.fake_dir, self.fake_dev)), shell=True,
env_variables={'PATH': '/sbin:/bin'}),
mock.call(('chroot %s /bin/bash -c '
mock.call(('chroot %s /bin/sh -c '
'"/usr/sbin/grub-mkconfig -o '
'/boot/grub/grub.cfg"' % self.fake_dir),
shell=True,

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Ironic Python Agent no longer requires 'bash' to be present in the user
image when preparing the partition image for local boot,
and uses default 'sh' interpreter to run 'grub'-related commands instead.