update to system fails with Exception value: 'NoneType' object has no attribute 'os_version'

Bug #943000 reported by C de-Avillez
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
cobbler (Ubuntu)
Fix Released
Critical
Unassigned
Oneiric
Fix Released
Critical
Unassigned

Bug Description

While I was trying to update a system/profile definition, I got hit by the backtrace below. Given the last line in the backtrace suggests this is an error in a 'distro' instance, I went and edited the disto affected: same error.

I then tried _other_ distros, and they also failed (but I did not try all). This was working as of 2.1.0+git20110602-0ubuntu26, ergo I suspect a regression.

Cobbler version: 2.1.0+git20110602-0ubuntu26.1Ubuntu version: Oneiric 11.10

Wed Feb 29 00:27:10 2012 - DEBUG | get_item; ['profile', 'lucid-i386']
Wed Feb 29 00:27:10 2012 - DEBUG | authorize; ['cobbler', 'save_profile', <cobbler.item_profile.Profile instance at 0x232dbd8>, None, True]Wed Feb 29 00:27:10 2012 - DEBUG | REMOTE cobbler authorization result: True; user(?)Wed Feb 29 00:27:10 2012 - INFO | add_item(profile); ['lucid-i386']
Wed Feb 29 00:27:10 2012 - DEBUG | get_items; ['profile']
Wed Feb 29 00:27:10 2012 - INFO | generating: /var/lib/tftpboot/pxelinux.cfg/01-bc-30-5b-e2-a1-80
Wed Feb 29 00:27:10 2012 - INFO | generating: /var/lib/tftpboot/grub/01-BC-30-5B-E2-A1-80
Wed Feb 29 00:27:10 2012 - INFO | generating: /var/lib/tftpboot/pxelinux.cfg/01-bc-30-5b-e2-a1-7a
Wed Feb 29 00:27:10 2012 - INFO | generating: /var/lib/tftpboot/grub/01-BC-30-5B-E2-A1-7A
Wed Feb 29 00:27:10 2012 - INFO | Exception occured: <type 'exceptions.AttributeError'>
Wed Feb 29 00:27:10 2012 - INFO | Exception value: 'NoneType' object has no attribute 'os_version'
Wed Feb 29 00:27:10 2012 - INFO | Exception Info:
  File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 1928, in _dispatch
    return method_handle(*params)
   File "/usr/lib/python2.7/dist-packages/cobbler/remote.py", line 933, in save_item
    rc = self.api.add_item(what,obj)
   File "/usr/lib/python2.7/dist-packages/cobbler/api.py", line 455, in add_item
    return self.get_items(what).add(ref,check_for_duplicate_names=check_for_duplicate_names,save=save,logger=logger)
   File "/usr/lib/python2.7/dist-packages/cobbler/collection.py", line 314, in add
    self.lite_sync.add_single_profile(ref.name)
   File "/usr/lib/python2.7/dist-packages/cobbler/action_litesync.py", line 119, in add_single_profile
    self.sync.pxegen.make_pxe_menu()
   File "/usr/lib/python2.7/dist-packages/cobbler/pxegen.py", line 312, in make_pxe_menu
    self.make_actual_pxe_menu()
   File "/usr/lib/python2.7/dist-packages/cobbler/pxegen.py", line 406, in make_actual_pxe_menu
    profile=None, distro=None, arch=image.arch, image=image)
   File "/usr/lib/python2.7/dist-packages/cobbler/pxegen.py", line 611, in write_pxe_file
    elif distro.os_version.startswith("esxi"):

ProblemType: BugDistroRelease: Ubuntu 11.10
Package: cobbler 2.1.0+git20110602-0ubuntu26.1
ProcVersionSignature: Ubuntu 3.0.0-12.20-server 3.0.4
Uname: Linux 3.0.0-12-server x86_64
ApportVersion: 1.23-0ubuntu4
Architecture: amd64
Date: Wed Feb 29 00:49:24 2012InstallationMedia: Ubuntu-Server 11.04 "Natty Narwhal" - Release amd64 (20110426)
PackageArchitecture: allSourcePackage: cobblerUpgradeStatus: Upgraded to oneiric on 2011-11-16 (104 days ago)

[SRU REQUEST] - ONEIRIC

[Impact]
If am image is found, during PXE setup, the process may abort with the backtrace above. When this happens, no updates or usage of the affected profiles/systems is possible anymore, effectively disabling Cobbler.

[Development Fix]
A fix has been written by Scott Moser, and uploaded to precise; an upstream merge has been requested (https://github.com/cobbler/cobbler/pull/94) and approved/applied

[Stable Fix]A fix to Oneiric has been proposed; this fix is slightly different from upstream due to changes in the code from 2.1 to 2.2.2 and GIT. A package has been built on a PPA (https://launchpad.net/~smoser/+archive/ppa) to field-test it; this same fix has already been deployed on personal package build by C de-Avillez.

[Test Case]
-- BEFORE applying the fix:
1. You MUST have images on your Cobbler install, and MUST try to update a profile/system with images.
2. Edit the profile/system;
3. Click on the SAVE button at the bottom.

FAILS -- an error is shown, and the /var/log/cobbler/cobbler.log shows a backtrace as above;

-- AFTER applying the fixed package, and AFTER restarting Cobbler:
Repeat steps (1)-(3) above.
SUCCEEDS -- the save completes with no errors.

[Regression Potential]
Patch is isolated, straightforward, and affects only the code path in the backtrace.

[Original Report]
This is it. Additionally, there is https://github.com/cobbler/cobbler/issues/16 upstream.

Related branches

Revision history for this message
C de-Avillez (hggdh2) wrote :
tags: added: regression-update
Revision history for this message
C de-Avillez (hggdh2) wrote :

Well. Following the backtrace we see:

403 for image in image_list:
404 if os.path.exists(image.file):
405 contents = self.write_pxe_file(filename=None, system=None,
406 profile=None, distro=None, arch=image.arch, image=image)

and distro is not otherwise set in write_pxe_file. So, no wonder the code barfs there.

Going on a limb, and marking confirmed.

Changed in cobbler (Ubuntu):
status: New → Confirmed
Revision history for this message
C de-Avillez (hggdh2) wrote :

I wonder if this is a consequence of a bug, not the bug itself. It is obvious how to bypass, but not so much clear how to correct.

Revision history for this message
C de-Avillez (hggdh2) wrote :

Bumping to critical, per request from Gema

Changed in cobbler (Ubuntu):
importance: Undecided → Critical
Revision history for this message
C de-Avillez (hggdh2) wrote :
Revision history for this message
Gema Gomez (gema) wrote :

Please, fix ASAP. This bug is blocking the automation of the kernel SRU testing and we are working hard to get this testing finished on all posible platforms as soon as posible.

C de-Avillez (hggdh2)
Changed in cobbler (Ubuntu Oneiric):
status: New → Triaged
importance: Undecided → Critical
Revision history for this message
C de-Avillez (hggdh2) wrote :

The upstream patch has to be adjusted:

(1) does not apply (the source file has changed a lot between 2.1 and current head)
(2) is not enough to fix the issue -- at least one more check on 'distro' has to be protected. In fact, there are other instances that I will not change (not in the code path we are taking).

Revision history for this message
Fabrice Coutadeur (fabricesp) wrote :

Hi Carlos,

It seems that the fix has not been applied to Precise (only the first chunk of the patch is there, from upstream). One of the rules for a SRU is to upload first the fix in the current dev version.
could you please propose a fix for Precise or at least check if the bug happens there too? I'll stay subscribed to the bug report so that I can upload it ASAP.

Also, could you add the information described at https://wiki.ubuntu.com/StableReleaseUpdates#Procedure ?

Thanks in advance,
Fabrice

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cobbler - 2.2.2-0ubuntu22

---------------
cobbler (2.2.2-0ubuntu22) precise; urgency=low

  [C de-Avillez]
  * fix stack trace in write_pxe_file (LP: #943000)
 -- Scott Moser <email address hidden> Wed, 07 Mar 2012 16:03:12 -0500

Changed in cobbler (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Scott Moser (smoser) wrote :

Carlos,
  Thanks for opening this bug, please fill out an SRU section in the bug description.
  I've uploaded a fix to precise, and opened an upstream merge request https://github.com/cobbler/cobbler/pull/94 .
  I've also uploaded a build to my ppa https://launchpad.net/~smoser/+archive/ppa which should finish later.

  Please could you test that and just make sure I didn't mess anything up? Then we'll upload to -proposed.

C de-Avillez (hggdh2)
description: updated
Revision history for this message
C de-Avillez (hggdh2) wrote :

@Scott: installed the PPA packages, no visible regression. It seems we are good to go.

Revision history for this message
C de-Avillez (hggdh2) wrote :

Let's hold this for a while -- I have just found that a 'cobbler sync' is generating the TFTPD files with the wrong permission (directories get recreated with 644, the PXE-boot files with 200 (!!), etc. Although I cannot see, right now, how this change would create such a mess, I have not yet looked at the code.

and the only change I can remember being done on this server was installing the patched Cobbler...

Revision history for this message
C de-Avillez (hggdh2) wrote :

OK. This bug (& patch) are cleared to go. I found my issue, and it had nothing to do with the patch.

Revision history for this message
James Page (james-page) wrote :

Thanks hggdh - Uploaded to oneiric-proposed.

Revision history for this message
Jonathan Riddell (jr) wrote :

subscribed ubuntu-sru so they know to review this

C de-Avillez (hggdh2)
description: updated
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Hello C, or anyone else affected,

Accepted cobbler into oneiric-proposed. The package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in cobbler (Ubuntu Oneiric):
status: Triaged → Fix Committed
tags: added: verification-needed
Revision history for this message
C de-Avillez (hggdh2) wrote :

updated to .26.2, all seems right, and I can update a system/profile/distro without issues. Tagging verification-done.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cobbler - 2.1.0+git20110602-0ubuntu26.2

---------------
cobbler (2.1.0+git20110602-0ubuntu26.2) oneiric-proposed; urgency=low

  * debian/patches/58_ubuntu_from_git_pxe_fails_on_image.patch:
    pxegen.py crashes if an image without distro is genned. Patch
    rebased & augmented from upstream Git. Other codepaths may
    lead to similar crashes, but I am only correcting the specific
    error we got. (LP: #943000)
 -- C de-Avillez <email address hidden> Thu, 01 Mar 2012 11:31:58 -0600

Changed in cobbler (Ubuntu Oneiric):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.