This function is just returns the device name without the /dev/
at the beginning. No need for a function.
---
autopart.py | 2 +-
fsset.py | 2 +-
iscsi.py | 2 +-
partIntfHelpers.py | 4 ++--
partedUtils.py | 4 ----
partitions.py | 4 ++--
6 files changed, 7 insertions(+), 11 deletions(-)
if dev.getName() != "RAIDDevice":
part = partedUtils.get_partition_by_name(diskset.disks, bootDev)
- drive = partedUtils.get_partition_drive(part)
+ drive = part.geometry.device.path[5:]
# on EFI systems, *only* /boot/efi should be marked bootable
# similarly, on pseries, we really only want the PReP partition
diff --git a/iscsi.py b/iscsi.py
index a4d301e..7fa8d40 100644
--- a/iscsi.py
+++ b/iscsi.py
@@ -583,7 +583,7 @@ class iscsi(object):
req.device)
if not part:
continue
- drive = partedUtils.get_partition_drive(part)
+ drive = part.geometry.device.path[5:]
if drive not in root_drives:
root_drives.append(drive)
diff --git a/partIntfHelpers.py b/partIntfHelpers.py
index d57b208..d133992 100644
--- a/partIntfHelpers.py
+++ b/partIntfHelpers.py
@@ -203,7 +203,7 @@ def doDeletePartitionByRequest(intf, requestlist, partition,
if request.getPreExisting():
if isinstance(request, partRequests.PartitionSpec):
# get the drive
- drive = partedUtils.get_partition_drive(partition)
+ drive = partition.geometry.device.path[5:]
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-12-2009, 01:05 AM
Jeremy Katz
Remove partedUtils.get_partition_drive()
On Wednesday, February 11 2009, David Cantrell said:
> This function is just returns the device name without the /dev/
> at the beginning. No need for a function.
While technically there's no need for a function, using one keeps us
from scattering information on the exact object structure everywhere.
Which means that if it changes, there's less places to have to adapt
Yes, we're bad about it in other places but we should probably make a
concerted effort not to be making direct, deep accesses into objects as they
always seem to come back and bite us eventually :/
Jeremy
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-12-2009, 01:28 AM
David Cantrell
Remove partedUtils.get_partition_drive()
Jeremy Katz wrote:
On Wednesday, February 11 2009, David Cantrell said:
This function is just returns the device name without the /dev/
at the beginning. No need for a function.
While technically there's no need for a function, using one keeps us
from scattering information on the exact object structure everywhere.
Which means that if it changes, there's less places to have to adapt
Yes, we're bad about it in other places but we should probably make a
concerted effort not to be making direct, deep accesses into objects as they
always seem to come back and bite us eventually :/
Not a problem, I'll just exclude this one when I merge.
Looking back at this particular patch, I think this was when I was going
through partedUtils.py trying to get rid of unnecessary things and/or
move things ot pyparted.
--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-12-2009, 04:16 AM
David Lehman
Remove partedUtils.get_partition_drive()
On Wed, 2009-02-11 at 14:53 -1000, David Cantrell wrote:
> This function is just returns the device name without the /dev/
> at the beginning. No need for a function.
> ---
> diff --git a/autopart.py b/autopart.py
> index b1c7644..d6fda51 100644
> --- a/autopart.py
> +++ b/autopart.py
> @@ -1160,7 +1160,7 @@ def doClearPartAction(anaconda, partitions, diskset):
> partitions.deleteDependentRequests(old)
> partitions.removeRequest(old)
>
> - drive = partedUtils.get_partition_drive(part)
> + drive = part.geometry.device.path[5:]
We could improve readability by using os.path.basename instead of the
slice. The same is true throughout the patch.
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-12-2009, 04:36 AM
David Cantrell
Remove partedUtils.get_partition_drive()
David Lehman wrote:
On Wed, 2009-02-11 at 14:53 -1000, David Cantrell wrote:
This function is just returns the device name without the /dev/
at the beginning. No need for a function.
---
diff --git a/autopart.py b/autopart.py
index b1c7644..d6fda51 100644
--- a/autopart.py
+++ b/autopart.py
@@ -1160,7 +1160,7 @@ def doClearPartAction(anaconda, partitions, diskset):
partitions.deleteDependentRequests(old)
partitions.removeRequest(old)
- drive = partedUtils.get_partition_drive(part)
+ drive = part.geometry.device.path[5:]
We could improve readability by using os.path.basename instead of the
slice. The same is true throughout the patch.
Good point, I'll change it in get_partition_name() and post a new patch.
--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-12-2009, 07:12 PM
David Cantrell
Remove partedUtils.get_partition_drive()
David Cantrell wrote:
David Lehman wrote:
On Wed, 2009-02-11 at 14:53 -1000, David Cantrell wrote:
This function is just returns the device name without the /dev/
at the beginning. No need for a function.
---
diff --git a/autopart.py b/autopart.py
index b1c7644..d6fda51 100644
--- a/autopart.py
+++ b/autopart.py
@@ -1160,7 +1160,7 @@ def doClearPartAction(anaconda, partitions,
diskset):
We could improve readability by using os.path.basename instead of the
slice. The same is true throughout the patch.
Good point, I'll change it in get_partition_name() and post a new patch.
New patch attached.
--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI
>From d754b55a984e7e311cbe49ee4d54df178d7bd61c Mon Sep 17 00:00:00 2001
From: David Cantrell <dcantrell@redhat.com>
Date: Thu, 12 Feb 2009 09:00:28 -1000
Subject: [PATCH 03/47] Use os.path.basename in partedUtils.get_partition_drive()
Use os.path.basename rather than slicing the string.
---
partedUtils.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
def get_partition_drive(partition):
"""Return the device name for disk that PedPartition partition is on."""
- return "%s" %(partition.geom.dev.path[5:])
+ return os.path.basename(partition.geom.dev.path)
def get_max_logical_partitions(disk):
if not disk.type.check_feature(parted.DISK_TYPE_EXTENDED) :
--
1.6.1.3
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-12-2009, 07:24 PM
Chris Lumens
Remove partedUtils.get_partition_drive()
> >From d754b55a984e7e311cbe49ee4d54df178d7bd61c Mon Sep 17 00:00:00 2001
> From: David Cantrell <dcantrell@redhat.com>
> Date: Thu, 12 Feb 2009 09:00:28 -1000
> Subject: [PATCH 03/47] Use os.path.basename in partedUtils.get_partition_drive()
>
> Use os.path.basename rather than slicing the string.
> ---
> partedUtils.py | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/partedUtils.py b/partedUtils.py
> index c170368..f7dab92 100644
> --- a/partedUtils.py
> +++ b/partedUtils.py
> @@ -210,7 +210,7 @@ def set_partition_file_system_type(part, fstype):
>
> def get_partition_drive(partition):
> """Return the device name for disk that PedPartition partition is on."""
> - return "%s" %(partition.geom.dev.path[5:])
> + return os.path.basename(partition.geom.dev.path)
>
> def get_max_logical_partitions(disk):
> if not disk.type.check_feature(parted.DISK_TYPE_EXTENDED) :
What happens when partition.geom.dev.path is /dev/cciss/wherever?
- Chris
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-12-2009, 07:37 PM
David Cantrell
Remove partedUtils.get_partition_drive()
Chris Lumens wrote:
>From d754b55a984e7e311cbe49ee4d54df178d7bd61c Mon Sep 17 00:00:00 2001
From: David Cantrell <dcantrell@redhat.com>
Date: Thu, 12 Feb 2009 09:00:28 -1000
Subject: [PATCH 03/47] Use os.path.basename in partedUtils.get_partition_drive()
Use os.path.basename rather than slicing the string.
---
partedUtils.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
"""Return the device name for disk that PedPartition partition is on."""
- return "%s" %(partition.geom.dev.path[5:])
+ return os.path.basename(partition.geom.dev.path)
def get_max_logical_partitions(disk):
if not disk.type.check_feature(parted.DISK_TYPE_EXTENDED) :
What happens when partition.geom.dev.path is /dev/cciss/wherever?
Oh piss, right, leave it to Compaq to make things not fun.
--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-12-2009, 08:12 PM
David Cantrell
Remove partedUtils.get_partition_drive()
David Cantrell wrote:
Chris Lumens wrote:
>From d754b55a984e7e311cbe49ee4d54df178d7bd61c Mon Sep 17 00:00:00 2001
From: David Cantrell <dcantrell@redhat.com>
Date: Thu, 12 Feb 2009 09:00:28 -1000
Subject: [PATCH 03/47] Use os.path.basename in
partedUtils.get_partition_drive()
Use os.path.basename rather than slicing the string.
---
partedUtils.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)