[PATCH 04/11] Add a method to reset a device to its original state.
David Lehman
dlehman at redhat.com
Wed Sep 26 14:44:07 UTC 2012
On Tue, 2012-09-25 at 17:46 -0700, Brian C. Lane wrote:
> On Tue, Sep 25, 2012 at 03:33:29PM -0500, David Lehman wrote:
> > ---
> > pyanaconda/storage/__init__.py | 9 +++++++++
> > 1 files changed, 9 insertions(+), 0 deletions(-)
> >
> > diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
> > index 7bf03bc..a949633 100644
> > --- a/pyanaconda/storage/__init__.py
> > +++ b/pyanaconda/storage/__init__.py
> > @@ -1221,6 +1221,15 @@ class Storage(object):
> > self.devicetree.registerAction(ActionDestroyFormat(device))
> > self.devicetree.registerAction(ActionCreateFormat(device, format))
> >
> > + def resetDevice(self, device):
> > + """ Cancel all scheduled actions and reset formatting. """
> > + actions = self.devicetree.findActions(device=device)
> > + for action in reversed(actions):
> > + self.devicetree.cancelAction(action)
> > +
> > + # make sure any random overridden attributes are reset
> > + device.format = device.originalFormat
> > +
>
> Should this be using copy.copy()? Otherwise we've just set a reference
> to the originalFormat, which was a copy of format and now changes will
> propagate again.
Haha, yes. I'm trying to make the mistake fixed by patch 3 again
already.
>
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
More information about the anaconda-patches
mailing list