Bug 230124 - hash_to_string function fails when one of the values is an integer
hash_to_string function fails when one of the values is an integer
Status: CLOSED DUPLICATE of bug 230063
Product: Fedora
Classification: Fedora
Component: cobbler (Show other bugs)
6
All Linux
medium Severity medium
: ---
: ---
Assigned To: Michael DeHaan
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-02-26 14:12 EST by Jonathan Manton
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-02-26 14:21:59 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jonathan Manton 2007-02-26 14:12:51 EST
Description of problem:

Function hash_to_string in file action_sync.py not robust when values are
integers rather than strings.  For example, this happened with me in the value
of the ramdisk for whatever it was trying to build during the sync (initrd RAM
size I think?)

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

How reproducible:
Always, as long as one of the values in the hash is an integer.


Steps to Reproduce:
1. cobbler sync
2.
3.
  
Actual results:

sync distro: var_www_cobbler_ks_mirror_fc6i386_os_images_xen
sync distro: var_www_cobbler_ks_mirror_fc6i386_os_images_pxeboot
sync profile: var_www_cobbler_ks_mirror_fc6i386_os_images_xen
sync profile: var_www_cobbler_ks_mirror_fc6i386_os_images_pxeboot
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 440, in sync
    self.api.sync()
  File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 122, in sync
    return sync.run()
  File "/usr/lib/python2.4/site-packages/cobbler/action_sync.py", line 69, in run
    self.build_trees()
  File "/usr/lib/python2.4/site-packages/cobbler/action_sync.py", line 492, in
build_trees
    self.write_distro_file(d)
  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


Expected results:
sync distro: var_www_cobbler_ks_mirror_fc6i386_os_images_xen
sync distro: var_www_cobbler_ks_mirror_fc6i386_os_images_pxeboot
sync profile: var_www_cobbler_ks_mirror_fc6i386_os_images_xen
sync profile: var_www_cobbler_ks_mirror_fc6i386_os_images_pxeboot
Shutting down dhcpd:                                       [  OK  ]
Starting dhcpd:                                            [  OK  ]


Additional info:

I changed line 885 to the following, and it fixed the problem (at least for me):

buffer = buffer + str(key) + "=" + str(value) + " "
Comment 1 Michael DeHaan 2007-02-26 14:21:59 EST

*** This bug has been marked as a duplicate of 230063 ***
Comment 2 Michael DeHaan 2007-02-26 14:22:48 EST
See #230063 for a patch that resolves this issue.  Will release shortly.

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