rerunning puppet can't fix various cobbler distro/profile problems

Bug #1099980 reported by Michael DeHaan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cisco Openstack
New
Medium
Sushma Korati
Folsom
Triaged
Wishlist
Michael DeHaan

Bug Description

Various operations in cobbler cannot be recovered by running Puppet again, due to the way the resources are coded up.

In particular:

1. delete a profile
2. run puppet again
3. profile precise-x86_64_auto will not come back

deleting the distro will also not make it come back. Nor deleting the ISO's directory.

Basically the whole system relies on running the Ubuntu-custom (non-upstream) import script that calls cobbler import, and we don't really need to do any of this since we are are not using local content.

Basically we just need to download the kernel and the initrd, and do "cobbler distro add", and then "cobbler profile add". At this point, we can also assign the preseed to the profile, instead of the system, as it should generally be intended to have one object to go to.

There are also some other minor issues with things, such as changing parameters on the profile or distro won't result in any edits to the object.

I think we were exploring various other courses of action including not having the distro creation be puppet driven, and instead having a very simple script to do it, pre-puppet setup, and then using something else as an external nodes resource.

This bug is basically just a record of "if you mess up your cobbler configuration, the way we have our Puppet coded, it can't put it back". Thus you have to know to 'not touch' these things. In general the Puppet content should converge you on desired state regardless of actual state, and it's not doing that here.

If we are going to continue to let Puppet drive Cobbler, we need a better solution that doesn't involve reinstalling the build node or fixing things manually. Though we should also consider not letting it drive and looking towards external nodes.

Michael DeHaan (mdehaan)
Changed in openstack-cisco:
importance: Undecided → Medium
Changed in openstack-cisco:
assignee: nobody → Sushma Korati (sushma-korati)
Revision history for this message
Sushma Korati (sushma-korati) wrote :

I am able to reproduce this issue with the above given steps.

But when I delete the distro and re-run puppet, both the profiles and distro are getting automatically created.
$cobbler list
distros:
   precise-x86_64

profiles:
   precise-x86_64
   precise-x86_64-auto
------

Reason:
This is because internally puppet scripts use "cobbler-ubuntu-import" command.

Issue:
If we re-run puppet apply without deleting the distro, "cobbler-ubuntu-import" command throws the below error:
$cobbler-ubuntu-import precise-x86_64
skipping import, as distro name already exists: precise-x86_64

$ puppet apply -v /etc/puppet/manifests/site.pp
<Execute successfully without errors>

Solution:
By adding a "exec" resource,we can check if "*-auto" profile exists else re-create. But the default profile should exists for creating the "*-auto" profile.

Checking the puppet scripts.

Revision history for this message
Sushma Korati (sushma-korati) wrote :

This issue can be fixed with below changes in File: $puppet/modules/cobbler/manifests/ubuntu.pp
Design:
1. If "-auto" profile object does not exist:
   1. Check if default profile object exists else create default profile object.
   2. Use this as parent and create a profile using "$cobbler profile add" command.
2. If profile does not exist:
   1. Check if distro exist else create a distro object
    2. Create profile using "$cobbler profile add" command.
3. If the distro does not exist:
   1. Create distro object using "$cobbler-ubuntu-import" command.

Adding two new exec blocks for re-creating the profiles if they does not exists.

    exec {"cobbler-profile-add-${name}-${arch}":
        command => "cobbler profile add --name ${name}-${arch} --distro ${name}-${arch}",
        path => "/usr/bin:/bin",
        provider => shell,
        unless => "cobbler profile list | grep precise-x86_64",
        onlyif => "test -n `cobbler distro list |grep precise-x86_64`",
        require => Exec["cobbler-import-$name-$arch"],
    }

    exec {"cobbler-profile-add-${name}-${arch}-auto":
        command => "cobbler profile add --name ${name}-${arch}-auto --parent ${name}-${arch}",
        path => "/usr/bin:/bin",
        provider => shell,
        unless => "cobbler profile list | grep precise-x86_64-auto",
        onlyif => "test -n `cobbler profile list |grep precise-x86_64`",
        require => Exec["cobbler-profile-add-${name}-${arch}"],
    }

#Anchor these Exec resource while creating profiles.
    anchor{ "cobbler-profile-${name}-${arch}":
        require => Exec["cobbler-profile-add-${name}-${arch}"],
    }
    anchor { "cobbler-profile-${name}-${arch}-auto":
        require => Exec["cobbler-profile-add-${name}-${arch}-auto"],
    }

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.