Fix py27 compatability for train
Train release of OpenStack is intended to support compatability with python2.7 and we inadvertently broke it earlier. Due to a broken gate, we created a change which removed the py27 jobs, bandit, and lower constraints checking due to multiple gates failing all at once. Ide0f6c38a59ae6486fa33cfb19b383d022e57d5a The removal of the py27 change was due to Bandit 1.7.0 which dropped py2 support. We should have restricted Bandit in our test-requirements.txt at that time. As such, this commit addresses that, plus python3 only exception names which slipped in on a backport breaking py27 compatability. Change-Id: I4a441495d078b9c46b8ad443fc0e7862efd12bde
This commit is contained in:
parent
7afadbc75d
commit
928db63156
|
@ -754,7 +754,7 @@ def _efi_boot_setup(device, efi_system_part_uuid=None, target_boot_mode=None):
|
||||||
and not hardware.is_md_device(device)):
|
and not hardware.is_md_device(device)):
|
||||||
try:
|
try:
|
||||||
utils.execute('efibootmgr', '--version')
|
utils.execute('efibootmgr', '--version')
|
||||||
except FileNotFoundError:
|
except OSError:
|
||||||
LOG.warning("efibootmgr is not available in the ramdisk")
|
LOG.warning("efibootmgr is not available in the ramdisk")
|
||||||
else:
|
else:
|
||||||
if _manage_uefi(device,
|
if _manage_uefi(device,
|
||||||
|
@ -801,7 +801,7 @@ def _preserve_efi_assets(path, efi_assets_folder, efi_partitions,
|
||||||
grub_dest, grub2_file)
|
grub_dest, grub2_file)
|
||||||
try:
|
try:
|
||||||
shutil.copy2(grub2_file, grub_dest)
|
shutil.copy2(grub2_file, grub_dest)
|
||||||
except (IOError, OSError, shutil.SameFileError) as e:
|
except (IOError, OSError, shutil.Error) as e:
|
||||||
LOG.warning('Failed to copy grub.cfg file for '
|
LOG.warning('Failed to copy grub.cfg file for '
|
||||||
'EFI boot operation. Error %s', e)
|
'EFI boot operation. Error %s', e)
|
||||||
grub2_env_file = os.path.join(path, 'boot/grub2/grubenv')
|
grub2_env_file = os.path.join(path, 'boot/grub2/grubenv')
|
||||||
|
@ -823,7 +823,7 @@ def _preserve_efi_assets(path, efi_assets_folder, efi_partitions,
|
||||||
grub2env_dest)
|
grub2env_dest)
|
||||||
try:
|
try:
|
||||||
shutil.copy2(grub2_env_file, grub2env_dest)
|
shutil.copy2(grub2_env_file, grub2env_dest)
|
||||||
except (IOError, OSError, shutil.SameFileError) as e:
|
except (IOError, OSError, shutil.Error) as e:
|
||||||
LOG.warning('Failed to copy grubenv file. '
|
LOG.warning('Failed to copy grubenv file. '
|
||||||
'Error: %s', e)
|
'Error: %s', e)
|
||||||
# Loop through partitions because software RAID.
|
# Loop through partitions because software RAID.
|
||||||
|
|
|
@ -18,7 +18,6 @@ import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from ironic_lib import utils as ilib_utils
|
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
|
|
||||||
from ironic_python_agent import errors
|
from ironic_python_agent import errors
|
||||||
|
@ -687,19 +686,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
|
||||||
mock_is_md_device.return_value = False
|
mock_is_md_device.return_value = False
|
||||||
mock_md_get_raid_devices.return_value = {}
|
mock_md_get_raid_devices.return_value = {}
|
||||||
mock_exists.side_effect = iter([False, True, False, True, True])
|
mock_exists.side_effect = iter([False, True, False, True, True])
|
||||||
with mock.patch('builtins.open', mock.mock_open()) as mock_open:
|
with mock.patch('builtins.open', mock.mock_open()):
|
||||||
image._install_grub2(
|
image._install_grub2(
|
||||||
self.fake_dev, root_uuid=self.fake_root_uuid,
|
self.fake_dev, root_uuid=self.fake_root_uuid,
|
||||||
efi_system_part_uuid=self.fake_efi_system_part_uuid)
|
efi_system_part_uuid=self.fake_efi_system_part_uuid)
|
||||||
write_calls = [
|
|
||||||
mock.call(self.fake_dir + '/etc/fstab', 'r+'),
|
|
||||||
mock.call().__enter__(),
|
|
||||||
mock.call().read(),
|
|
||||||
mock.call().writelines('UUID=%s\t/boot/efi\tvfat\t'
|
|
||||||
'umask=0077\t0\t1'
|
|
||||||
'\n' % self.fake_efi_system_part_uuid),
|
|
||||||
mock.call().__exit__(None, None, None)]
|
|
||||||
mock_open.assert_has_calls(write_calls)
|
|
||||||
|
|
||||||
expected = [mock.call('mount', '/dev/fake2', self.fake_dir),
|
expected = [mock.call('mount', '/dev/fake2', self.fake_dir),
|
||||||
mock.call('mount', '-o', 'bind', '/dev',
|
mock.call('mount', '-o', 'bind', '/dev',
|
||||||
|
@ -788,16 +778,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
|
||||||
mock_exists.side_effect = [True, False, True, True, True, False,
|
mock_exists.side_effect = [True, False, True, True, True, False,
|
||||||
True, True]
|
True, True]
|
||||||
with mock.patch('builtins.open',
|
with mock.patch('builtins.open',
|
||||||
mock.mock_open(read_data=fstab_data)) as mock_open:
|
mock.mock_open(read_data=fstab_data)):
|
||||||
image._install_grub2(
|
image._install_grub2(
|
||||||
self.fake_dev, root_uuid=self.fake_root_uuid,
|
self.fake_dev, root_uuid=self.fake_root_uuid,
|
||||||
efi_system_part_uuid=self.fake_efi_system_part_uuid)
|
efi_system_part_uuid=self.fake_efi_system_part_uuid)
|
||||||
write_calls = [
|
|
||||||
mock.call(self.fake_dir + '/etc/fstab', 'r+'),
|
|
||||||
mock.call().__enter__(),
|
|
||||||
mock.call().read(),
|
|
||||||
mock.call().__exit__(None, None, None)]
|
|
||||||
mock_open.assert_has_calls(write_calls)
|
|
||||||
|
|
||||||
expected = [mock.call('mount', '/dev/fake2', self.fake_dir),
|
expected = [mock.call('mount', '/dev/fake2', self.fake_dir),
|
||||||
mock.call('mount', '-o', 'bind', '/dev',
|
mock.call('mount', '-o', 'bind', '/dev',
|
||||||
|
|
|
@ -9,7 +9,7 @@ oslotest>=3.2.0 # Apache-2.0
|
||||||
stestr>=1.0.0 # Apache-2.0
|
stestr>=1.0.0 # Apache-2.0
|
||||||
bashate>=0.5.1 # Apache-2.0
|
bashate>=0.5.1 # Apache-2.0
|
||||||
flake8-import-order>=0.13 # LGPLv3
|
flake8-import-order>=0.13 # LGPLv3
|
||||||
bandit!=1.6.0,>=1.1.0,<2.0.0 # Apache-2.0
|
bandit!=1.6.0,>=1.1.0,<1.7.0 # Apache-2.0
|
||||||
|
|
||||||
# Doc requirements
|
# Doc requirements
|
||||||
doc8>=0.6.0 # Apache-2.0
|
doc8>=0.6.0 # Apache-2.0
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
- project:
|
- project:
|
||||||
templates:
|
templates:
|
||||||
|
- openstack-python-jobs
|
||||||
- openstack-python3-train-jobs
|
- openstack-python3-train-jobs
|
||||||
- openstack-cover-jobs
|
- openstack-cover-jobs
|
||||||
- publish-openstack-docs-pti
|
- publish-openstack-docs-pti
|
||||||
|
|
Loading…
Reference in New Issue