Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 230063

Summary: TypeError: cannot concatenate 'str' and 'int' objects
Product: [Fedora] Fedora Reporter: Raf Nijskens <rnijskens>
Component: cobblerAssignee: Michael DeHaan <mdehaan>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 6CC: jmanton
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-02-26 15:49:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Raf Nijskens 2007-02-26 12:51:20 UTC
Description of problem:
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 505, in main
    BootCLI(sys.argv).run()
  File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 102, in run
    self.curry_args(self.args[1:], self.commands['toplevel'])
  File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 421, in
curry_args
    commands[args[0]](args[1:])
  File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 469, in distro
    return self.curry_args(args, self.commands['distro'])
  File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 421, in
curry_args
    commands[args[0]](args[1:])
  File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 386, in
distro_edit
    return self.apply_args(args,commands,on_ok)
  File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 409, in
apply_args
    on_ok()
  File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 385, in <lambda>
    on_ok = lambda: self.api.distros().add(distro, with_copy=self.api.sync_flag)
  File "/usr/lib/python2.4/site-packages/cobbler/collection.py", line 97, in add
    lite_sync.add_single_distro(ref.name)
  File "/usr/lib/python2.4/site-packages/cobbler/action_litesync.py", line 60,
in add_single_distro
    self.sync.write_distro_file(distro)
  File "/usr/lib/python2.4/site-packages/cobbler/action_sync.py", line 733, in
write_distro_file
    clone.kernel_options = self.hash_to_string(clone.kernel_options)
  File "/usr/lib/python2.4/site-packages/cobbler/action_sync.py", line 885, in
hash_to_string
    buffer = buffer + key + "=" + value + " "
TypeError: cannot concatenate 'str' and 'int' objects


Version-Release number of selected component (if applicable):
Version: 0.4.2
Release: 0.fc6


How reproducible:
cobbler distro add --name="fc6.xen.i686" --kernel="/home/raf/Cobbler/vmlinuz"
--initrd="/home/raf/Cobbler/initrd.img"

Steps to Reproduce:
1. download vmlinuz:
ftp://mirrors.hpcf.upr.edu/pub/Mirrors/redhat/download.fedora.redhat.com/6/i386/os/images/xen/vmlinuz
2. download initrd:
ftp://mirrors.hpcf.upr.edu/pub/Mirrors/redhat/download.fedora.redhat.com/6/i386/os/images/xen/initrd.img
3. cobbler distro add --name="fc6.xen.i686" --kernel="/Cobbler/vmlinuz"
--initrd="/Cobbler/initrd.img"
  
Actual results:


Expected results:


Additional info:


Solution (TESTED):
vi action_sync.py
:885

Change:
buffer = buffer + key + "=" + value + " "
TO:
buffer = buffer + str(key) + "=" + str(value) + " "

Comment 1 Michael DeHaan 2007-02-26 15:48:38 UTC
Yep, this is a known issue and I plan on releasing a fix early this week. 
You're exactly right in what the correction needs to be.   Thanks for filing the
report.

Here's an excerpt from an email I sent out to et-mgmt-tools@redhat.com several
days ago.  If you are intereted in cobbler features/development, it's a good
list to join if you aren't following it already. 

diff -r fbdb0203b3ee41519942c705ec800333b70c3365 cobbler/action_sync.py
--- a/cobbler/action_sync.py Wed Feb 21 10:30:33 2007 -0500
+++ b/cobbler/action_sync.py Thu Feb 22 10:44:21 2007 -0500
@@ -874,8 +874,8 @@ class BootSync:
for key in hash:
value = hash[key]
if value is None:
- buffer = buffer + key + " "
+ buffer = buffer + str(key) + " "
else:
- buffer = buffer + key + "=" + value + " "
+ buffer = buffer + str(key) + "=" + str(value) + " "
return buffer 

Comment 2 Michael DeHaan 2007-02-26 19:22:01 UTC
*** Bug 230124 has been marked as a duplicate of this bug. ***