Bug 693655

Summary: AttributeError: 'str' object has no attribute 'rpartition'
Product: Red Hat Enterprise Linux 5 Reporter: Alexander Todorov <atodorov>
Component: anacondaAssignee: Will Woods <wwoods>
Status: CLOSED CURRENTRELEASE QA Contact: Release Test Team <release-test-team-automation>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.7CC: borgan, mgracik
Target Milestone: betaKeywords: TestBlocker
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: anaconda-11.1.2.230-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-12 07:48:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 693654    
Attachments:
Description Flags
updates-rhel5-693655.img
none
updates-rhel5-693655.img (fixed for RHEL5-style updates) none

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