Re: Looping through possibilities in a "snippet"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Apr 11, 2008, at 1:05 PM, Michael DeHaan wrote:

I've implemented this here -- with only a slight change to the way the above behavior works (basically there are no distro-overrides
and the paths are slightly different):

https://fedorahosted.org/cobbler/wiki/KickstartSnippets

It's under the "Advanced Snippets" section and is available now in the git/devel branch. Testing welcome!

I've tested this out with a fairly simple contrived example, and it worked perfectly. I created the following files and directories:

# find /var/lib/cobbler/snippets -type f
/var/lib/cobbler/snippets/packages
/var/lib/cobbler/snippets/post
/var/lib/cobbler/snippets/pre
/var/lib/cobbler/snippets/per_profile/packages/testprofile
/var/lib/cobbler/snippets/per_profile/post/testprofile
/var/lib/cobbler/snippets/per_profile/pre/testprofile


I created this profile:

# cobbler profile report --name=testprofile
profile         : testprofile
parent          : rhel5Server-x86_64
kickstart       : /etc/cobbler/foo.ks
(... snip ...)

And then added two system records:

# cobbler system add --name=system1 --ip=172.24.10.10 --mac="00:16:3e: 43:22:02" --profile=rhel5Server-x86_64

# cobbler system add --name=system2 --ip=172.24.20.20 --mac="00:16:3e: 40:0a:a3" --profile=testprofile

... and ran "cobbler sync"; the rendered kickstarts in /var/www/ cobbler/kickstarts_sys/{system1,system2}/ks.cfg contained exactly what I expected (system1's had the contents of snippets/ {packages,post,pre}, and system2's had the contents of snippets/ per_profile/{packages,post,pre}/testprofile.)

This is a totally awesome improvement, and when the devel version is ready for prime-time, it is going to make a *huge* difference in the simplicity of our systems deployment.

I've got a few comments about the testing process and some issues I ran into; these comments shouldn't be construed as criticism, as I expect most of those issues are of my own making or ignorance. That said:

* I'd never used "git", nor installed it before. It took me a little bit to figure out how to get it onto an RHEL5 system, but once I set up the EPEL yum repo, it installed cleanly. The PatchProcess wiki page helped immensely in getting going, but I think it would be useful to have a "How to build a devel branch RPM on an RHEL5 system for dummies" page (I'd be happy to write it, unless y'all think this is something that shouldn't be in the wiki.)

* The last version of cobbler I built (from the src.rpm) was 0.8.2. Sometime between that version and the devel, a dependancy on the python-ldap module was added. The RPM built, but all cobbler actions failed with the traceback:

  ... (snip)
File "/usr/lib/python2.4/site-packages/cobbler/modules/ authn_ldap.py", line 20, in ?
    import ldap
ImportError: No module named ldap


Perhaps I just missed something that stated that requirement. It would be really nice, though, if those of us that have no use for the authentication parts (ldap, for one) could disable it, perhaps with a config variable like "use_ldap: 0".

* This might be a known issue, but when I imported a distro ...

# mount -o loop ./rhel-5.1-server-x86_64-dvd.iso /mnt
# cobbler import --path=/mnt --name=rhel5Server-x86_64

... it ran fine, and then exited with the below traceback. The distro appeared to suffer no ill effect from this error, or, at least it worked for everything that I tested in this limited setup environment:

- processing: /var/www/cobbler/ks_mirror/rhel5Server-x86_64/images/xen
---------------- (associating kickstarts)
- finding default kickstart template for redhat 5.0
- tree: http://@@http_server@@/cblr/links/rhel5Server-x86_64
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 53, in main
    return BootCLI().run(sys.argv)
File "/usr/lib/python2.4/site-packages/cobbler/cobbler.py", line 42, in run
    return self.loader.run(args)
File "/usr/lib/python2.4/site-packages/cobbler/commands.py", line 69, in run
    return fn.run()
File "/usr/lib/python2.4/site-packages/cobbler/modules/ cli_misc.py", line 97, in run
    arch=self.options.arch
File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 351, in import_tree
    return importer.run()
File "/usr/lib/python2.4/site-packages/cobbler/action_import.py", line 155, in run
    self.kickstart_finder()
File "/usr/lib/python2.4/site-packages/cobbler/action_import.py", line 224, in kickstart_finder
    self.distros.add(distro,save=True) # re-save
File "/usr/lib/python2.4/site-packages/cobbler/collection.py", line 206, in add
    self.lite_sync.add_single_distro(ref.name)
File "/usr/lib/python2.4/site-packages/cobbler/action_litesync.py", line 62, in add_single_distro
    self.sync.copy_single_distro_files(distro)
File "/usr/lib/python2.4/site-packages/cobbler/action_sync.py", line 319, in copy_single_distro_files
    utils.linkfile(kernel, os.path.join(distro_dir, b_kernel))
File "/usr/lib/python2.4/site-packages/cobbler/utils.py", line 561, in linkfile
    return utils.copyfile(src, dst)
NameError: global name 'utils' is not defined


Like I said, this new improvement in snippet handling greatly benefits us, and I'm really excited to be able to deploy it, hopefully soon (I'll wait until its available in the "stable" branch ... our cobbler server has become too important for me to screw up! :-)

Thanks again, Michael!

	-s-








_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux