Re: [PATCH] Fix action pruning to handle more complex scenarios.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +            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

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux