Bug 693655 - AttributeError: 'str' object has no attribute 'rpartition'
Summary: AttributeError: 'str' object has no attribute 'rpartition'
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: anaconda
Version: 5.7
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: beta
: ---
Assignee: Will Woods
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks: rhel57rtt
TreeView+ depends on / blocked
 
Reported: 2011-04-05 08:35 UTC by Alexander Todorov
Modified: 2011-04-18 20:36 UTC (History)
2 users (show)

Fixed In Version: anaconda-11.1.2.230-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-04-12 07:48:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
updates-rhel5-693655.img (1.25 KB, application/octet-stream)
2011-04-05 15:19 UTC, Will Woods
no flags Details
updates-rhel5-693655.img (fixed for RHEL5-style updates) (100.00 KB, application/octet-stream)
2011-04-05 22:31 UTC, Will Woods
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0984 0 normal SHIPPED_LIVE anaconda bug fix and enhancement update 2011-07-20 15:45:09 UTC

Description Alexander Todorov 2011-04-05 08:35:02 UTC
Description of problem:

Running anaconda, the Red Hat Enterprise Linux Server system installer - please wait... 
Traceback (most recent call last): 
  File "/usr/bin/anaconda", line 568, in ? 
    import signal, traceback, string, isys, iutil, time 
  File "/usr/lib/anaconda/isys.py", line 26, in ? 
    import iutil 
  File "/usr/lib/anaconda/iutil.py", line 23, in ? 
    from flags import flags 
  File "/usr/lib/anaconda/flags.py", line 103, in ? 
    flags = Flags() 
  File "/usr/lib/anaconda/flags.py", line 77, in __init__ 
    self.__dict__['flags']['cmdline'] = self.createCmdlineDict() 
  File "/usr/lib/anaconda/flags.py", line 40, in createCmdlineDict 
    (left, middle, right) = cmdline.rpartition("BOOT_IMAGE=") 
AttributeError: 'str' object has no attribute 'rpartition' 
install exited abnormally [1/1]  


Version-Release number of selected component (if applicable):
anaconda-11.1.2.229

How reproducible:
Always in Beaker.

Steps to Reproduce:
1. Run automated test job - text mode install.
2.

Comment 2 Martin Gracik 2011-04-05 08:53:54 UTC
Looks like python in rhel 5.7 is older than 2.5. str.rpartition() is available only in 2.5 and later.

Comment 3 RHEL Program Management 2011-04-05 14:19:31 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 4 Will Woods 2011-04-05 15:19:19 UTC
Created attachment 490012 [details]
updates-rhel5-693655.img

Aw jeez, I thought I checked on that. Proposed patch using rstrip (which was definitely around in python 2.4) instead:

diff --git a/flags.py b/flags.py
index a5d380a..41f4858 100644
--- a/flags.py
+++ b/flags.py
@@ -37,9 +37,10 @@ class Flags:
         # if the BOOT_IMAGE contains a space, pxelinux will strip one of the
         # quotes leaving one at the end that shlex doesn't know what to do
         # with
-        (left, middle, right) = cmdline.rpartition("BOOT_IMAGE=")
-        if right.count('"') % 2:
-            cmdline = left + middle + '"' + right
+        if "BOOT_IMAGE=" in cmdline:
+            (left, right) = cmdline.rsplit("BOOT_IMAGE=",1)
+            if right.count('"') % 2:
+                cmdline = left + 'BOOT_IMAGE="' + right
 
         lst = shlex.split(cmdline)
 
Attached updates.img contains this code; could someone confirm that it actually works as expected?

Comment 5 Will Woods 2011-04-05 22:31:06 UTC
Created attachment 490097 [details]
updates-rhel5-693655.img (fixed for RHEL5-style updates)

Comment 6 Alexander Todorov 2011-04-07 11:21:29 UTC
The updates.img works for me but then I hit bug #694440


Note You need to log in before you can comment on or make changes to this bug.