Comment 3 for bug 1099980

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"],
    }