diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2018-12-07 11:29:02 -0500 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2020-04-07 16:43:35 -0400 |
commit | a2720ae0cb9c73724dbcd4eb5c5a2816acac5ce9 (patch) | |
tree | ca806d8e58715b249af9b86d19a0570a7a37f1be /tests/option_tests.py | |
parent | e4977719b7c35190b3c2099ad46f965265c8257b (diff) | |
download | sos-a2720ae0cb9c73724dbcd4eb5c5a2816acac5ce9.tar.gz |
[Plugin] Add new method for iterating over storage devices
Adds a new mechanism for iterating over a list of devices with a given
command or list of commands. This is to allow us to stop doing ad-hoc
device enumeration in multiple plugins and instead provide a consistent
behavior for iterating over devices such as disks.
Before setting up plugins, sos will now enumerate a list of block
devices and fibre devices that is made available to the plugins. From
there the new 'add_blockdev_cmd()' method may be passed a command or
list of commands that will be iterated over for every device. Commands
passed need to include '%(dev)s' in the appropriate place for device
name substitution. By default this will iterate over all discovered
block devices. The 'devices' parameter may be used to change this,
either by passing 'fibre' to instead iterate over fibre devices, or by
passing a list of devices to use directly.
To filter out or restrict commands to running on specific types of
devices, the blacklist and whitelist parameters can be used respectively
and can accept either a single regex string or a list of regexes.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to 'tests/option_tests.py')
-rw-r--r-- | tests/option_tests.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/option_tests.py b/tests/option_tests.py index ffd06610..133570f0 100644 --- a/tests/option_tests.py +++ b/tests/option_tests.py @@ -24,7 +24,8 @@ class GlobalOptionTest(unittest.TestCase): self.commons = { 'sysroot': '/', 'policy': LinuxPolicy(init=InitSystem()), - 'cmdlineopts': MockOptions() + 'cmdlineopts': MockOptions(), + 'devices': {} } self.plugin = Plugin(self.commons) self.plugin.opt_names = ['baz', 'empty', 'test_option'] |