Skip to content

Commit

Permalink
Add a property indicating the type to pass to get_format.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwlehman committed Feb 1, 2016
1 parent 611f0d4 commit e3e8224
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions blivet/populator/helpers/formatpopulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,19 @@ def _get_kwargs(self):
"exists": True}
return kwargs

def run(self):
""" Create a format instance and associate it with the device instance. """
kwargs = self._get_kwargs()
@property
def type_spec(self):
if self._type_specifier is not None:
type_spec = self._type_specifier
else:
type_spec = udev.device_get_format(self.data)
type_spec = udev.device_get_format(self.data) or None

return type_spec

def run(self):
""" Create a format instance and associate it with the device instance. """
kwargs = self._get_kwargs()
type_spec = self.type_spec
try:
log.info("type detected on '%s' is '%s'", self.device.name, type_spec)
self.device.format = formats.get_format(type_spec, **kwargs)
Expand Down

0 comments on commit e3e8224

Please sign in to comment.