forked from rpms/python-blivet
		
	Look the disk up for a partition by name not sys_name (#1445302)
This commit is contained in:
		
							parent
							
								
									20c0102e21
								
							
						
					
					
						commit
						f96713f6cd
					
				| @ -5,7 +5,7 @@ Version: 2.1.8 | ||||
| 
 | ||||
| #%%global prerelease .b1 | ||||
| # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 | ||||
| Release: 1%{?prerelease}%{?dist} | ||||
| Release: 2%{?prerelease}%{?dist} | ||||
| Epoch: 1 | ||||
| License: LGPLv2+ | ||||
| Group: System Environment/Libraries | ||||
| @ -13,6 +13,8 @@ Group: System Environment/Libraries | ||||
| %global realversion %{version}%{?prerelease} | ||||
| Source0: http://github.com/rhinstaller/blivet/archive/%{realname}-%{realversion}.tar.gz | ||||
| 
 | ||||
| Patch0: rhbz1445302.patch | ||||
| 
 | ||||
| # Versions of required components (done so we make sure the buildrequires | ||||
| # match the requires versions of things). | ||||
| %global pykickstartver 1.99.22 | ||||
| @ -62,6 +64,7 @@ configuration. | ||||
| 
 | ||||
| %prep | ||||
| %setup -q -n %{realname}-%{realversion} | ||||
| %patch0 -p1 | ||||
| 
 | ||||
| rm -rf %{py3dir} | ||||
| cp -a . %{py3dir} | ||||
|  | ||||
							
								
								
									
										40
									
								
								rhbz1445302.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								rhbz1445302.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,40 @@ | ||||
| From 7ef50d3b7061353838e44c8dc202eb5f6b012f40 Mon Sep 17 00:00:00 2001 | ||||
| From: Vratislav Podzimek <vpodzime@redhat.com> | ||||
| Date: Thu, 4 May 2017 13:03:06 +0200 | ||||
| Subject: [PATCH] Look the disk up for a partition by name not sys_name | ||||
| 
 | ||||
| udev.device_get_partition_disk() returns the device name as given | ||||
| by device_get_name() not sys_name. So when trying to find a match | ||||
| we need to compare it to the same value for devices we iterate | ||||
| over. | ||||
| 
 | ||||
| Also don't call resolve_devspec() on the returned value, | ||||
| udev.device_get_partition_disk() is already doing it. | ||||
| 
 | ||||
| Resolves: rhbz#1445302 | ||||
| ---
 | ||||
|  blivet/populator/helpers/partition.py | 8 ++++---- | ||||
|  1 file changed, 4 insertions(+), 4 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/populator/helpers/partition.py b/blivet/populator/helpers/partition.py
 | ||||
| index 617b5e7..73b15f1 100644
 | ||||
| --- a/blivet/populator/helpers/partition.py
 | ||||
| +++ b/blivet/populator/helpers/partition.py
 | ||||
| @@ -57,13 +57,13 @@ def run(self):
 | ||||
|                  return device | ||||
|   | ||||
|          disk = None | ||||
| -        sys_name = udev.device_get_partition_disk(self.data)
 | ||||
| -        if sys_name:
 | ||||
| -            disk_name = udev.resolve_devspec(sys_name)
 | ||||
| +        disk_name = udev.device_get_partition_disk(self.data)
 | ||||
| +        if disk_name:
 | ||||
|              disk = self._devicetree.get_device_by_name(disk_name) | ||||
|              if disk is None: | ||||
|                  # create a device instance for the disk | ||||
| -                disk_info = next((i for i in udev.get_devices() if i.sys_name == sys_name), None)
 | ||||
| +                disk_info = next((i for i in udev.get_devices()
 | ||||
| +                                  if udev.device_get_name(i) == disk_name), None)
 | ||||
|                  if disk_info is not None: | ||||
|                      self._devicetree.handle_device(disk_info) | ||||
|                      disk = self._devicetree.get_device_by_name(disk_name) | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user