[rhinstaller/blivet/pulls/71 master] Consolidate common code in DeviceFormat class methods.

vpodzime installerbot-noreply at redhat.com
Wed Apr 8 07:42:58 UTC 2015


> @@ -96,55 +95,29 @@ def dict(self):
>                    "peStart": self.peStart, "dataAlignment": self.dataAlignment})
>          return d
>  
> -    def create(self, **kwargs):
> -        """ Write the formatting to the specified block device.
> -
> -            :keyword device: path to device node
> -            :type device: str
> -            :raises: FormatCreateError
> -            :returns: None.
> -
> -            .. :note::
> -
> -                If a device node path is passed to this method it will overwrite
> -                any previously set value of this instance's "device" attribute.
> -        """
> +    def _create(self, **kwargs):
>          log_method_call(self, device=self.device,
>                          type=self.type, status=self.status)
>  
> -        try:
> -            DeviceFormat.create(self, **kwargs)
> -            # Consider use of -Z|--zero
> -            # -f|--force or -y|--yes may be required
> +        # Consider use of -Z|--zero
> +        # -f|--force or -y|--yes may be required
>  
> -            # lvm has issues with persistence of metadata, so here comes the
> -            # hammer...
> +        # lvm has issues with persistence of metadata, so here comes the
> +        # hammer...
> +        self.exists = True

The logic of setting ``self.exists`` to True here and changing it to False if something fails is quite weird. Could we please set it to False (or leave it as it is) here and set it to True if we successfully get to the end?

-- 
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/71#discussion_r27948764


More information about the anaconda-patches mailing list