Merge "Bump hacking to 3.0.0"

This commit is contained in:
Zuul 2020-03-31 12:36:11 +00:00 committed by Gerrit Code Review
commit 68a71513f0
7 changed files with 30 additions and 31 deletions

View File

@ -236,16 +236,15 @@ class IronicPythonAgent(base.ExecuteCommandMixin):
# we've previously seen a token, which is
# a mid-cluster upgrade case with long-running ramdisks.
if (not token and self.agent_token
and not self.agent_token_required):
# TODO(TheJulia): Rip this out during or after the V
# cycle.
LOG.warning('Agent token for requests are not required '
'by the conductor, yet we received a token. '
'Cluster may be mid-upgrade. Support to '
'not fail in this condition will be removed in '
'the Victoria development cycle.')
# Tell the API everything is okay.
return True
and not self.agent_token_required):
# TODO(TheJulia): Rip this out during or after the V cycle.
LOG.warning('Agent token for requests are not required '
'by the conductor, yet we received a token. '
'Cluster may be mid-upgrade. Support to '
'not fail in this condition will be removed in '
'the Victoria development cycle.')
# Tell the API everything is okay.
return True
if self.agent_token is not None:
return self.agent_token == token

View File

@ -111,8 +111,8 @@ def _get_partition(device, uuid):
# device has a partition (which we assume to contain the root fs).
if hardware.is_md_device(device):
md_partition = device + 'p1'
if (os.path.exists(md_partition) and
stat.S_ISBLK(os.stat(md_partition).st_mode)):
if (os.path.exists(md_partition)
and stat.S_ISBLK(os.stat(md_partition).st_mode)):
LOG.debug("Found md device with partition %s",
md_partition)
return md_partition

View File

@ -416,12 +416,12 @@ def _validate_image_info(ext, image_info=None, **kwargs):
os_hash_algo = image_info.get('os_hash_algo')
os_hash_value = image_info.get('os_hash_value')
if os_hash_algo or os_hash_value:
if (not isinstance(os_hash_algo, str) or
not os_hash_algo):
if (not isinstance(os_hash_algo, str)
or not os_hash_algo):
raise errors.InvalidCommandParamsError(
'Image \'os_hash_algo\' must be a non-empty string.')
if (not isinstance(os_hash_value, str) or
not os_hash_value):
if (not isinstance(os_hash_value, str)
or not os_hash_value):
raise errors.InvalidCommandParamsError(
'Image \'os_hash_value\' must be a non-empty string.')
os_hash_checksum_avail = True

View File

@ -339,9 +339,9 @@ def list_all_block_devices(block_type='disk',
# Other possible type values, which we skip recording:
# lvm, part, rom, loop
if devtype != block_type:
if (devtype is not None and
any(x in devtype for x in ['raid', 'md']) and
not ignore_raid):
if (devtype is not None
and any(x in devtype for x in ['raid', 'md'])
and not ignore_raid):
LOG.debug(
"TYPE detected to contain 'raid' or 'md', signifying a "
"RAID volume. Found: {!r}".format(line))
@ -930,8 +930,8 @@ class GenericHardwareManager(HardwareManager):
if sys_child['id'] == 'core':
for core_child in sys_child['children']:
if _MEMORY_ID_RE.match(core_child['id']):
if (not core_child.get("children") and
core_child.get('size')):
if (not core_child.get("children")
and core_child.get('size')):
value = ("%(size)s %(units)s" % core_child)
physical += int(UNIT_CONVERTER(value).to
('MB').magnitude)
@ -1400,7 +1400,7 @@ class GenericHardwareManager(HardwareManager):
cmd = "ipmitool lan6 print {} {}_addr".format(
channel, 'dynamic' if dynamic else 'static')
try:
out, e = utils.execute(cmd, shell=True)
out, exc = utils.execute(cmd, shell=True)
except processutils.ProcessExecutionError:
return
@ -1409,9 +1409,9 @@ class GenericHardwareManager(HardwareManager):
# dynamic_addr and static_addr commands is a valid yaml.
try:
out = yaml.safe_load(out.strip())
except yaml.YAMLError as e:
except yaml.YAMLError as excpt:
LOG.warning('Cannot process output of "%(cmd)s" '
'command: %(e)s', {'cmd': cmd, 'e': e})
'command: %(e)s', {'cmd': cmd, 'e': excpt})
return
for addr_dict in out.values():
@ -1446,9 +1446,9 @@ class GenericHardwareManager(HardwareManager):
except ValueError as exc:
LOG.warning('Invalid IP address %s: %s', address, exc)
continue
except (processutils.ProcessExecutionError, OSError) as e:
except (processutils.ProcessExecutionError, OSError) as exc:
# Not error, because it's normal in virtual environment
LOG.warning("Cannot get BMC v6 address: %s", e)
LOG.warning("Cannot get BMC v6 address: %s", exc)
return
return '::/0'
@ -1759,7 +1759,7 @@ class GenericHardwareManager(HardwareManager):
LOG.debug('Removing partitions on %s', holder_disk)
try:
utils.execute('wipefs', '-af', holder_disk)
except processutils.ProcessExecutionError as e:
except processutils.ProcessExecutionError:
LOG.warning('Failed to remove partitions on %s',
holder_disk)

View File

@ -181,12 +181,12 @@ def _get_vmedia_params():
try:
stdout, stderr = execute("umount", vmedia_mount_point)
except processutils.ProcessExecutionError as e:
except processutils.ProcessExecutionError:
pass
finally:
try:
shutil.rmtree(vmedia_mount_point)
except Exception as e:
except Exception:
pass
return params

View File

@ -22,7 +22,7 @@ flake8-import-order==0.13
flake8==2.5.5
future==0.16.0
greenlet==0.4.13
hacking==1.0.0
hacking==3.0.0
idna==2.6
imagesize==1.0.0
ironic-lib==2.17.0

View File

@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=1.0.0,<1.1.0 # Apache-2.0
hacking>=3.0.0,<3.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
mock>=2.0.0 # BSD
testtools>=2.2.0 # MIT