[blivet:master 12/16] Change keyword parameters in devicetree.findActions
mulhern
amulhern at redhat.com
Thu May 1 13:08:49 UTC 2014
Also update invocations appropriately.
Signed-off-by: mulhern <amulhern at redhat.com>
---
blivet/__init__.py | 4 ++--
blivet/devicetree.py | 21 ++++++++++-----------
tests/action_test.py | 14 +++++++-------
3 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index 180ca36..fe2a153 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -2045,8 +2045,8 @@ class Blivet(object):
fresh_disks = [d.name for d in self.disks if d.partitioned and
not d.format.exists]
- destroy_actions = self.devicetree.findActions(type="destroy",
- object="device")
+ destroy_actions = self.devicetree.findActions(action_type="destroy",
+ object_type="device")
cleared_partitions = []
partial = False
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 9e7663f..7f6ceef 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -475,8 +475,8 @@ class DeviceTree(object):
self._actions.remove(action)
log.info("canceled action %s", action)
- def findActions(self, device=None, type=None, object=None, path=None,
- devid=None):
+ def findActions(self, device=None, action_type=None, object_type=None,
+ path=None, devid=None):
""" Find all actions that match all specified parameters.
A value of None for any of the keyword arguments indicates that any
@@ -484,10 +484,10 @@ class DeviceTree(object):
:keyword device: device to match
:type device: :class:`~.devices.StorageDevice` or None
- :keyword type: action type to match (eg: "create", "destroy")
- :type type: str or None
- :keyword object: operand type to match (eg: "device" or "format")
- :type object: str or None
+ :keyword action_type: action type to match (eg: "create", "destroy")
+ :type action_type: str or None
+ :keyword object_type: operand type to match (eg: "device" or "format")
+ :type object_type: str or None
:keyword path: device path to match
:type path: str or None
:keyword devid: device id to match
@@ -496,13 +496,13 @@ class DeviceTree(object):
:rtype: list of :class:`~.deviceaction.DeviceAction`
"""
- if device is None and type is None and object is None and \
+ if device is None and action_type is None and object_type is None and \
path is None and devid is None:
return self._actions[:]
# convert the string arguments to the types used in actions
- _type = action_type_from_string(type)
- _object = action_object_from_string(object)
+ _type = action_type_from_string(action_type)
+ _object = action_object_from_string(object_type)
actions = []
for action in self._actions:
@@ -1077,8 +1077,7 @@ class DeviceTree(object):
# make sure this device was not scheduled for removal and also has not
# been hidden
- removed = [a.device for a in
- self.findActions(type="destroy", object="device")]
+ removed = [a.device for a in self.findActions(action_type="destroy", object_type="device")]
for ignored in removed + self._hidden:
if (sysfs_path and ignored.sysfsPath == sysfs_path) or \
(uuid and uuid in (ignored.uuid, ignored.format.uuid)):
diff --git a/tests/action_test.py b/tests/action_test.py
index 35decb5..6468c7f 100644
--- a/tests/action_test.py
+++ b/tests/action_test.py
@@ -630,8 +630,8 @@ class DeviceActionTestCase(StorageTestCase):
# its PVs, and the devices that contain the PVs
lv_root = self.storage.devicetree.getDeviceByName("VolGroup-lv_root")
self.assertNotEqual(lv_root, None)
- actions = self.storage.devicetree.findActions(type="create",
- object="device",
+ actions = self.storage.devicetree.findActions(action_type="create",
+ object_type="device",
device=lv_root)
self.assertEqual(len(actions), 1,
"wrong number of device create actions for lv_root: "
@@ -641,8 +641,8 @@ class DeviceActionTestCase(StorageTestCase):
vgs = [d for d in self.storage.vgs if d.name == "VolGroup"]
self.assertNotEqual(vgs, [])
vg = vgs[0]
- actions = self.storage.devicetree.findActions(type="create",
- object="device",
+ actions = self.storage.devicetree.findActions(action_type="create",
+ object_type="device",
device=vg)
self.assertEqual(len(actions), 1,
"wrong number of device create actions for VolGroup")
@@ -655,7 +655,7 @@ class DeviceActionTestCase(StorageTestCase):
self.assertNotEqual(pvs, [])
for pv in pvs:
# include device and format create actions for each pv
- actions = self.storage.devicetree.findActions(type="create",
+ actions = self.storage.devicetree.findActions(action_type="create",
device=pv)
self.assertEqual(len(actions), 2,
"wrong number of device create actions for "
@@ -692,8 +692,8 @@ class DeviceActionTestCase(StorageTestCase):
# require each other, regardless of the partitions' numbers
sda1 = self.storage.devicetree.getDeviceByName("sda1")
self.assertNotEqual(sda1, None)
- actions = self.storage.devicetree.findActions(type="create",
- object="device",
+ actions = self.storage.devicetree.findActions(action_type="create",
+ object_type="device",
device=sda1)
self.assertEqual(len(actions), 1,
"wrong number of create actions found for sda1")
--
1.8.3.1
More information about the anaconda-patches
mailing list