[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [PATCH] Fix action pruning to handle more complex scenarios.
- From: Chris Lumens <clumens redhat com>
- To: anaconda-devel-list redhat com
- Subject: Re: [PATCH] Fix action pruning to handle more complex scenarios.
- Date: Wed, 11 Mar 2009 10:07:55 -0400
> + log.debug("action '%s' (%s)" % (a, id(a)))
> + destroys = self.findActions(path=a.device.path,
> + type="destroy",
> + object="device")
> +
> + creates = self.findActions(path=a.device.path,
> + type="create",
> + object="device")
> +
> + # If the device is not preexisting, we remove all actions up
> + # to and including the last destroy action.
> + # If the device is preexisting, we remove all actions from
> + # after the first destroy action up to and including the last
> + # destroy action.
> + loops = []
> + first_destroy_idx = None
> + first_create_idx = None
> + stop_action = None
> + start = None
> + if len(destroys) > 1:
> + # there are multiple destroy actions for this device
> + loops = destroys
> + first_destroy_idx = self._actions.index(loops[0])
> + start = self._actions.index(a) + 1
> + stop_action = destroys[-1]
> +
> + if creates:
> + first_create_idx = self._actions.index(creates[0])
> + if not loops or first_destroy_idx > first_create_idx:
> + # this device is not preexisting
> + start = first_create_idx
> + stop_action = destroys[-1]
> +
> + if start is None:
> continue
I see this block four times in the patch, though twice it's
destroys/creates, and twice it's creates/destroys. Any chance that
could be functionalized?
- Chris
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]