Bug 998221

Summary: Cobbler: python2.7 exception in cobbler/utils.py on import of RHEL 6.4 DVD
Product: [Fedora] Fedora Reporter: Richard Chan <rc556677>
Component: cobblerAssignee: James C. <jimi>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 19CC: awood, bill-bugzilla.redhat.com, jimi, jmunilla, scott, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: cobbler-2.4.4-1.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-03 19:57:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Distro file, works for RHEL6.4 none

Description Richard Chan 2013-08-18 11:32:24 UTC
Created attachment 787759 [details]
Distro file, works for RHEL6.4

Description of problem:
Python exception in cobbler/utils.py on import of RHEL6.4 DVD

Version-Release number of selected component (if applicable):
2.4.0-1.fc19

How reproducible:
Always

Steps to Reproduce:
1. cobbler import --name=rhel6.4 --path=/mnt/rhel-DVD
2.
3.

Actual results:

task started: 2013-08-18_184532_import
task started (id=Media import, time=Sun Aug 18 18:45:32 2013)
Found a candidate signature: breed=redhat, version=rhel6
Found a matching signature: breed=redhat, version=rhel6
Adding distros from path /var/www/cobbler/ks_mirror/TESTNG-x86_64:
creating new distro: TESTNG-x86_64
Exception occured: <class 'cobbler.cexceptions.CX'>
Exception value: 'invalid input type'
Exception Info:
  File "/usr/local/src/cobbler/cobbler/remote.py", line 89, in run
    rc = self._run(self)
   File "/usr/local/src/cobbler/cobbler/remote.py", line 232, in runner
    self.logger
   File "/usr/local/src/cobbler/cobbler/api.py", line 925, in import_tree
    return import_module.run(path,mirror_name,network_root,kickstart_file,arch,breed,os_version)
   File "/usr/local/src/cobbler/cobbler/modules/manage_import_signatures.py", line 141, in run
    os.path.walk(self.path, self.distro_adder, distros_added)
   File "/usr/lib64/python2.7/posixpath.py", line 246, in walk
    walk(name, func, arg)
   File "/usr/lib64/python2.7/posixpath.py", line 246, in walk
    walk(name, func, arg)
   File "/usr/lib64/python2.7/posixpath.py", line 238, in walk
    func(arg, top, names)
   File "/usr/local/src/cobbler/cobbler/modules/manage_import_signatures.py", line 256, in distro_adder
    adtls.append(self.add_entry(dirname,kernel,initrd))
   File "/usr/local/src/cobbler/cobbler/modules/manage_import_signatures.py", line 313, in add_entry
    distro.set_kernel_options(self.signature.get("kernel_options",""))
   File "/usr/local/src/cobbler/cobbler/item.py", line 177, in set_kernel_options
    (success, value) = utils.input_string_or_hash(options,allow_multiples=True)
   File "/usr/local/src/cobbler/cobbler/utils.py", line 584, in input_string_or_hash
    raise CX(_("invalid input type"))

!!! TASK FAILED !!!

Expected results:
Cobbbler distro imported successfully

Additional info:
I have tracked down the "invalid input type" to be  unicode which the function cannot handle


The unicode options happens to have len = 0
If I modify line 546

if options is None or options == "delete" or len(options) == 0: // ignore unicode strings of len 0

the import succeeds.

My import invokes utils.input_string_or_hash twice with unicode options.

Comment 1 Richard Chan 2013-08-18 11:33:49 UTC
Upstream: this looks like
https://github.com/cobbler/cobbler/issues/528

Comment 2 Richard Chan 2013-08-18 11:49:17 UTC
This seems to have been fixed in upstream, vide the following code:


    if options == "<<inherit>>":
        options = {}

    if options is None or options == "delete":
        return (True, {})
    elif isinstance(options, list):
        raise CX(_("No idea what to do with list: %s") % options)
    elif isinstance(options, str) or isinstance(options, unicode):
        new_dict = {}
        tokens = shlex.split(options)


etc etc

Comment 3 Raul Cheleguini 2013-10-17 01:54:15 UTC
Yes, the following patch fixes the issue: 

https://github.com/cobbler/cobbler/issues/528#issuecomment-22832421

Tested with cobbler-2.4.0-1.fc19.noarch


# cobbler import --name=fedora19 --arch=x86_64 --path=/mnt/iso
task started: 2013-10-16_225112_import
task started (id=Media import, time=Wed Oct 16 22:51:12 2013)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=fedora16
Found a candidate signature: breed=redhat, version=fedora17
Found a candidate signature: breed=redhat, version=fedora18
Found a candidate signature: breed=redhat, version=fedora19
Found a matching signature: breed=redhat, version=fedora19
Adding distros from path /var/www/cobbler/ks_mirror/fedora19-x86_64:
creating new distro: fedora19-x86_64
trying symlink: /var/www/cobbler/ks_mirror/fedora19-x86_64 -> /var/www/cobbler/links/fedora19-x86_64
creating new profile: fedora19-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/fedora19-x86_64 for fedora19-x86_64
processing repo at : /var/www/cobbler/ks_mirror/fedora19-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/fedora19-x86_64
looking for /var/www/cobbler/ks_mirror/fedora19-x86_64/repodata/*comps*.xml
running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/fedora19-x86_64/repodata/bf4e62e367e9b80e4f7c75092ef729f69d5d8e2d3eadd3c852ba6c5eb7a85353-Fedora-19-comps.xml /var/www/cobbler/ks_mirror/fedora19-x86_64
received on stdout: Spawning worker 0 with 988 pkgs
Spawning worker 1 with 987 pkgs
Spawning worker 2 with 987 pkgs
Spawning worker 3 with 987 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

received on stderr: 
*** TASK COMPLETE ***

Comment 4 Bill McGonigle 2014-01-02 07:38:49 UTC
Hit this on f19 with a CentOS 6.5 spin.  n.b. restart cobblerd to get the patch to take effect (that's probably obvious to many...)

James, would you take a patch/SPEC revision on this to get cobbler working out-of-the-box on f19 again?

Comment 5 Fedora Update System 2014-04-21 20:33:27 UTC
cobbler-2.4.3-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/cobbler-2.4.3-1.fc19

Comment 6 Fedora Update System 2014-04-21 20:33:51 UTC
cobbler-2.4.3-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/cobbler-2.4.3-1.fc20

Comment 7 Fedora Update System 2014-04-22 15:33:46 UTC
cobbler-2.4.4-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/cobbler-2.4.4-1.fc20

Comment 8 Fedora Update System 2014-04-22 15:34:54 UTC
cobbler-2.4.4-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/cobbler-2.4.4-1.fc19

Comment 9 Fedora Update System 2014-04-22 15:36:01 UTC
cobbler-2.4.4-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/cobbler-2.4.4-1.el6

Comment 10 Fedora Update System 2014-04-22 15:36:58 UTC
cobbler-2.4.4-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/cobbler-2.4.4-1.el5

Comment 11 Fedora Update System 2014-04-22 19:56:16 UTC
Package cobbler-2.4.4-1.el5:
* should fix your issue,
* was pushed to the Fedora EPEL 5 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing cobbler-2.4.4-1.el5'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2014-1211/cobbler-2.4.4-1.el5
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2014-05-03 19:57:20 UTC
cobbler-2.4.4-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2014-05-08 21:59:34 UTC
cobbler-2.4.4-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2014-05-09 02:56:35 UTC
cobbler-2.4.4-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2014-05-09 22:01:40 UTC
cobbler-2.4.4-1.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.