Bump hacking to 3.0.0
The new version enables a lot of standard flake8 checks, so a few fixes are required. W503 is disabled as it conflicts with W504 and the latter seems to be preferred nowadays. Change-Id: I929ff36eaa47a42bc551f5c37bd40f64bc4f14d0
This commit is contained in:
parent
f2053341af
commit
6c9d5dc58b
@ -67,7 +67,7 @@ CONF.register_opts(opts, group='disk_utils')
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
_PARTED_PRINT_RE = re.compile(r"^(\d+):([\d\.]+)MiB:"
|
||||
"([\d\.]+)MiB:([\d\.]+)MiB:(\w*):(.*):(.*);")
|
||||
r"([\d\.]+)MiB:([\d\.]+)MiB:(\w*):(.*):(.*);")
|
||||
|
||||
CONFIGDRIVE_LABEL = "config-2"
|
||||
MAX_CONFIG_DRIVE_SIZE_MB = 64
|
||||
@ -282,8 +282,8 @@ def make_partitions(dev, root_mb, swap_mb, ephemeral_mb,
|
||||
# a PrEP partition at the start of the disk. This is an 8 MiB partition
|
||||
# with the boot and prep flags set. The bootloader should be installed
|
||||
# here.
|
||||
if (cpu_arch.startswith("ppc64") and boot_mode == "bios" and
|
||||
boot_option == "local"):
|
||||
if (cpu_arch.startswith("ppc64") and boot_mode == "bios"
|
||||
and boot_option == "local"):
|
||||
LOG.debug("Add PReP boot partition (8 MB) to device: "
|
||||
"%(dev)s for node %(node)s",
|
||||
{'dev': dev, 'node': node_uuid})
|
||||
@ -906,11 +906,11 @@ def create_config_drive_partition(node_uuid, device, configdrive):
|
||||
confdrive_mb, confdrive_file = _get_configdrive(configdrive,
|
||||
node_uuid)
|
||||
if confdrive_mb > MAX_CONFIG_DRIVE_SIZE_MB:
|
||||
raise exception.InstanceDeployFailure(
|
||||
_('Config drive size exceeds maximum limit of 64MiB. '
|
||||
'Size of the given config drive is %(size)d MiB for '
|
||||
'node %(node)s.')
|
||||
% {'size': confdrive_mb, 'node': node_uuid})
|
||||
raise exception.InstanceDeployFailure(
|
||||
_('Config drive size exceeds maximum limit of 64MiB. '
|
||||
'Size of the given config drive is %(size)d MiB for '
|
||||
'node %(node)s.')
|
||||
% {'size': confdrive_mb, 'node': node_uuid})
|
||||
|
||||
LOG.debug("Adding config drive partition %(size)d MiB to "
|
||||
"device: %(dev)s for node %(node)s",
|
||||
@ -959,8 +959,8 @@ def create_config_drive_partition(node_uuid, device, configdrive):
|
||||
"node %(node)s. Creating config drive "
|
||||
"at the end of the disk %(disk)s.",
|
||||
{'node': node_uuid, 'disk': device})
|
||||
startlimit = (MAX_DISK_SIZE_MB_SUPPORTED_BY_MBR -
|
||||
MAX_CONFIG_DRIVE_SIZE_MB - 1)
|
||||
startlimit = (MAX_DISK_SIZE_MB_SUPPORTED_BY_MBR
|
||||
- MAX_CONFIG_DRIVE_SIZE_MB - 1)
|
||||
endlimit = MAX_DISK_SIZE_MB_SUPPORTED_BY_MBR - 1
|
||||
|
||||
utils.execute('parted', '-a', 'optimal', '-s', '--', device,
|
||||
|
@ -104,8 +104,8 @@ class Counter(object):
|
||||
raise TypeError(_("The metric name is expected to be a string. "
|
||||
"Value is %s") % name)
|
||||
|
||||
if (sample_rate is not None and
|
||||
(sample_rate < 0.0 or sample_rate > 1.0)):
|
||||
if (sample_rate is not None
|
||||
and (sample_rate < 0.0 or sample_rate > 1.0)):
|
||||
msg = _("sample_rate is set to %s. Value must be None "
|
||||
"or in the interval [0.0, 1.0]") % sample_rate
|
||||
raise ValueError(msg)
|
||||
|
@ -511,6 +511,12 @@ class MakePartitionsTestCase(base.IronicLibTestCase):
|
||||
return ['parted', '-a', 'optimal', '-s', dev,
|
||||
'--', 'unit', 'MiB', 'mklabel', label]
|
||||
|
||||
def _add_efi_sz(self, x):
|
||||
return str(x + self.efi_size)
|
||||
|
||||
def _add_bios_sz(self, x):
|
||||
return str(x + self.bios_size)
|
||||
|
||||
def _test_make_partitions(self, mock_exc, boot_option, boot_mode='bios',
|
||||
disk_label=None, cpu_arch=""):
|
||||
mock_exc.return_value = ('', '')
|
||||
@ -521,14 +527,13 @@ class MakePartitionsTestCase(base.IronicLibTestCase):
|
||||
cpu_arch=cpu_arch)
|
||||
|
||||
if boot_option == "local" and boot_mode == "uefi":
|
||||
add_efi_sz = lambda x: str(x + self.efi_size)
|
||||
expected_mkpart = ['mkpart', 'primary', 'fat32', '1',
|
||||
add_efi_sz(1),
|
||||
self._add_efi_sz(1),
|
||||
'set', '1', 'boot', 'on',
|
||||
'mkpart', 'primary', 'linux-swap',
|
||||
add_efi_sz(1), add_efi_sz(513), 'mkpart',
|
||||
'primary', '', add_efi_sz(513),
|
||||
add_efi_sz(1537)]
|
||||
self._add_efi_sz(1), self._add_efi_sz(513),
|
||||
'mkpart', 'primary', '', self._add_efi_sz(513),
|
||||
self._add_efi_sz(1537)]
|
||||
else:
|
||||
if boot_option == "local":
|
||||
if disk_label == "gpt":
|
||||
@ -539,14 +544,15 @@ class MakePartitionsTestCase(base.IronicLibTestCase):
|
||||
'9', '521', 'mkpart', 'primary',
|
||||
'', '521', '1545']
|
||||
else:
|
||||
add_bios_sz = lambda x: str(x + self.bios_size)
|
||||
expected_mkpart = ['mkpart', 'primary', '', '1',
|
||||
add_bios_sz(1),
|
||||
self._add_bios_sz(1),
|
||||
'set', '1', 'bios_grub', 'on',
|
||||
'mkpart', 'primary', 'linux-swap',
|
||||
add_bios_sz(1), add_bios_sz(513),
|
||||
self._add_bios_sz(1),
|
||||
self._add_bios_sz(513),
|
||||
'mkpart', 'primary', '',
|
||||
add_bios_sz(513), add_bios_sz(1537)]
|
||||
self._add_bios_sz(513),
|
||||
self._add_bios_sz(1537)]
|
||||
elif cpu_arch.startswith('ppc64'):
|
||||
expected_mkpart = ['mkpart', 'primary', '', '1', '9',
|
||||
'set', '1', 'boot', 'on',
|
||||
@ -563,8 +569,8 @@ class MakePartitionsTestCase(base.IronicLibTestCase):
|
||||
'513', 'mkpart', 'primary', '', '513',
|
||||
'1537']
|
||||
self.dev = 'fake-dev'
|
||||
parted_cmd = (self._get_parted_cmd(self.dev, disk_label) +
|
||||
expected_mkpart)
|
||||
parted_cmd = (self._get_parted_cmd(self.dev, disk_label)
|
||||
+ expected_mkpart)
|
||||
parted_call = mock.call(*parted_cmd, use_standard_locale=True,
|
||||
run_as_root=True, check_exit_code=[0])
|
||||
fuser_cmd = ['fuser', 'fake-dev']
|
||||
|
@ -66,14 +66,14 @@ def execute(*cmd, **kwargs):
|
||||
Executes and logs results from a system command. See docs for
|
||||
oslo_concurrency.processutils.execute for usage.
|
||||
|
||||
:param \*cmd: positional arguments to pass to processutils.execute()
|
||||
:param cmd: positional arguments to pass to processutils.execute()
|
||||
:param use_standard_locale: keyword-only argument. True | False.
|
||||
Defaults to False. If set to True,
|
||||
execute command with standard locale
|
||||
added to environment variables.
|
||||
:param log_stdout: keyword-only argument. True | False. Defaults
|
||||
to True. If set to True, logs the output.
|
||||
:param \*\*kwargs: keyword arguments to pass to processutils.execute()
|
||||
:param kwargs: keyword arguments to pass to processutils.execute()
|
||||
:returns: (stdout, stderr) from process execution
|
||||
:raises: UnknownArgumentError on receiving unknown arguments
|
||||
:raises: ProcessExecutionError
|
||||
|
@ -15,7 +15,7 @@ flake8-import-order==0.13
|
||||
flake8==2.5.5
|
||||
future==0.16.0
|
||||
greenlet==0.4.10
|
||||
hacking==1.0.0
|
||||
hacking==3.0.0
|
||||
imagesize==0.7.1
|
||||
iso8601==0.1.11
|
||||
Jinja2==2.10
|
||||
|
@ -5,7 +5,7 @@
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT
|
||||
flake8-import-order>=0.13 # LGPLv3
|
||||
hacking>=1.0.0,<1.1.0 # Apache-2.0
|
||||
hacking>=3.0.0,<3.1.0 # Apache-2.0
|
||||
mock>=2.0.0 # BSD
|
||||
stestr>=1.0.0 # Apache-2.0
|
||||
oslotest>=3.2.0 # Apache-2.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user