The _execute helper was catching OSError, except it
was expecting the same attributes as ProcessExecutionError,
which is incorrect.
Added a separate catch and unit test to ensure that we
at least properly catch and convert the error instead of
raising an error about an attribute that does not exist.
Change-Id: Id47715a5657478e4d9dd10ea7f360b1ededa27de
Closes-Bug: #1715466
When inspecting block devices on a node, discover and
report the /dev/disk/by-path/XXX name along with the
/dev/XXX block device name.
The second name does not change between Linux system
reboots and has greater chances to be the same across
similarly configured nodes.
Note: this patch depends on
https://review.openstack.org/#/c/500524/
library patch, but this dependency can't be expressed
with Depends-On clause. Therefore once this patch
requires a followup patch to enable one currently disabled
test in this patch.
Change-Id: I09874f19890500d352521f89573e2aaf50a29022
Closes-Bug: #1679726
* Remove support for setting IPMI credentials (removed from inspector in Pike)
* Stop sending the ipmi_address field (bmc_address is used instead since Pike)
Change-Id: I1696041db62ba27e5d31e8481cb225a43d7e2a46
Closes-Bug: #1654318
It seems to be incorrect at least for some iLO machines.
Also harden the code against invalid output from ipmitool.
Change-Id: I733785e9c7d86eadca963f0776910504bf91bcfe
Closes-Bug: #1714944
It may happen that BMC is configured to use non-zero channel.
In this case we should iterate across all of them as long as we
get a correct IP address (in this case different than "0.0.0.0"
which is a placeholder for not configured console).
Change-Id: I3c351af1882b24c8f56e4363249b19b5c3a4a446
Closes-Bug: #1702514
Fixes nits, modifies unit tests.
This is a follow-up to commit c5544fb7a0d9d2a1481b3256c3587259368b599e.
Change-Id: Ibca82cc6e32311b1ff0be7137d8392f63e12639b
Closes-Bug: #1635057
Implements an optional collector 'collect_dmidecode_info' for
collecting detailed info of processor, memory and BIOS and
adds it to the inspection data.
Collects BIOS, processor, memory info and adds under the 'dmi' key.
Change-Id: Ida9b418ca579b15de70d17886631f3b21697987e
Closes-Bug: #1635057
Oslo.config deprecated parameter enforce_type and change its
default value to True in Ifa552de0a994e40388cbc9f7dbaa55700ca276b0.
Remove the usage of it to avoid DeprecationWarning: "Using the
'enforce_type' argument is deprecated in version '4.0' and will be
removed in version '5.0': The argument enforce_type has changed its
default value to True and then will be removed completely."
Change-Id: I0f0fb540c43edde64e489915c5199da40a0da9c1
Related--Bug: #1517839
This change removes the now unused "warnerrors" setting,
which is replaced by "warning-is-error" in sphinx
releases >= 1.5 [1].
[1] http://lists.openstack.org/pipermail/openstack-dev/
2017-March/113085.html
Change-Id: I9bf18ff72f36dfd3496b9672604e8bb98999b133
Currently, get_bios_given_nic_name logs 'biosdevname not found' for
every NIC. This patch changes it to log only once when the executable
is not found.
Removes a redundant 'return' statement.
Change-Id: Ic42ec23876b6f7b28d8f6ac1bd37bdbfa20cf421
This is the version we have in global-requirements, and it does not
contain module pint.errors. Fortunately, in all versions the required
error is exposed on the top level, so just use it.
See https://review.rdoproject.org/r/6741 for a build failure.
Change-Id: I1f194ccc48a3195fcbf8599c3a0b4fa21fde16d2
This replaces the deprecated (in python 3.2) unittest.TestCase
method assertRaisesRegexp() with assertRaisesRegex()[1].
[1]https://review.openstack.org/#/c/466155/
Change-Id: Ife8504dbb58019a30bcc1495a78ab14c757efc98
Related-Bug: 1673768
Adds an extra field ``biosdevname`` to network interface inventory
collected by ``default`` inspection collector (which collects the whole
inventory returned by hardware manager) of ironic-python-agent.
This feature requires biosdevname utility to collect the bios given NIC
names. The tooling module for tinyIPA is created for the same purpose.
For CoreOS IPA pxe images, biosdevname tooling module is limited,
because Docker repository is created and embedded into CoreOS pxe
images. The Docker repository uses debian to download the packages.
Debian does not have biosdevname package.
Adds an export variable TINYIPA_REQUIRE_BIOSDEVNAME. Set this
variable to ``true`` in your shell before building tinyIPA.
Closes-Bug: #1635351
Change-Id: Ia96af59e2a74868cac59e5a88cfbb3be60d85687
Implement the optional collector for fetching the NUMA topology
details.
Collects RAM, CPU Cores, thread siblings and NICS data for
each NUMA node and stored under "numa_topology" key.
Closes-bug: #1635253
Co-Authored-By: Jaganathan Palanisamy <jpalanis@redhat.com>
Change-Id: I5a546c009d95f39b7af4d89cf785be8acb8ebc67
Signed-off-by: karthik s <ksundara@redhat.com>
This change introduces a new base test class that mocks out
utils.execute and forces an exception if it gets called.
This has rooted out many tests that were doing this as a side effect of
calling other functions, doing things like modprobe and running iscsi
on the host's actual machine.
The tests are all now appropriately patched in places where this was
happening, and the new base class permanently prevents this from
accidentally happening again.
If you really want to call utils.execute() then you need to re-mock it
in your unit test.
Change-Id: Idf87d09a9c01a6bfe2767f8becabe65c02983518
inspection_dhcp_wait_timeout is defined as IntOpt, but its value was
set in tests to 0.01. This was ok until oslo.config started enforcing
types in [1], after that unit tests fail for test_timeout.
Fixing by setting the value to 1, and mocking time-related functions
to avoid a longer wait.
[1] https://review.openstack.org/328692
Change-Id: I732c4aa3d1760c3159d9672e3fae81f8bd72497c
Add missing 'autospec' keyword argument to mock.patch and
mock.patch.object calls. Use 'autospec=True' except for a few cases
where it fails because the mocked function is a @classmethod and it
doesn't work. In that case explicity set it to 'autospec=False'
Change-Id: I620dce91abaa4440e1803aeefb3e93c0b65d1419
Specify 'ironic_python_agent' as the name of the application for the
flake8-import-order plugin. That way it knows that imports of
ironic_python_agent should come after external libraries.
Change-Id: Id39d558a51aeb97d96633afea28676634547d0d7
Make sure that logs are encoded as text (not byte strings) in
python3 to allow theirs serialization in JSON.
Closes-Bug: #1668533
Change-Id: I3d0d87ca766146457d905f89c26331a415bd54f8
This fixes unreadable output on download image failure.
Adding new instance variable to exception `ImageDownloadError` class
to avoid redundant logs.
Change-Id: I51782abd572588adfc62745eeab9c559eb8346dd
Closes-Bug: #1657691
Use the flake8 plugin flake8-import-order to check import ordering. It
can do it automatically and don't need reviewers to check it.
Change-Id: I946457e9079ce0b54c7fe0ad554d024a1c61dce0
Removes two reserved fields ``switch_port_descr`` and
``switch_chassis_descr`` that were deprecated in the Newton cycle.
Change-Id: Icd2251af63a69d60d1e72eddf651a168fdae94fa
If there is a problem with psutil failing we have a catch-all
exception. Explain reasoning for the catch-all exception.
Change-Id: Id2e22e4ff93d96c795f474e72a684dfe3db87a58
Global requirements was recently updated to force psutil=>3.0.1. This
patch removes support for older versions of psutil as well as changing
to opportunistically attempt to work if a version >5 is released but
doesn't change the interface we use.
Change-Id: I1f7fab33fd275fb8b5cd7704dc13375402756d06
Related-bug: #1659137
An upper-constraints update to psutil caused IPA to start using psutil
5.0.1. We had a hard-coded assumption that psutil would be major version
1 or 2. This allows us to use the updated psutil and attempts to simply
fail gracefully if an unrecognized psutil version is used.
Change-Id: Ibe072440159561b34a29b478d955876e5fb7f103
Closes-Bug: 1659137
The CoreOS IPA images do not support poweroff/reboot due to running in a
chroot. For this case, we fall back to forcing poweroff or reboot via
sysrq commands
Change-Id: I75d68b6308beba299d043e43a5fa1671b6ef3ada
Closes-Bug: #1628367
In cases where unit tests are running in a env where IPv6 isn't enabled
it was returning the IPv4 wildcard address.
Change-Id: I0ebadafca70d9cddf761f2ef54726e0123af10f5